Script Not Running

If none of the more specific forums is the right place to ask

Script Not Running

Postby spen24423 » 2017-03-09 02:51

I am trying to run this script on Debian;

#!/bin/bash
#
# Debian
#

set -v

apt-get -y update

apt-get install -y ntpdate
apt-get install -y squid3 apache2-utils

cp /etc/squid3/squid.conf /etc/squid3/squid.conf.bak

cat << EOF > /etc/squid3/squid.conf
http_port 3128
http_access allow all
cache deny all
forwarded_for delete
request_header_access Via deny all
EOF

/etc/init.d/squid3 restart

echo "IP ADDRESS"

curl ifconfig.co

#Be sure to shutdown/terminate your VM after you are done!

When I upload it and run the script using;
chmod +x proxy-debian-linux_.sh
sudo ./proxy-debian-linux_.sh

I get the error; cannot access:"Proxy-Debian-Linux" no such file or directory. How is this? Why is this? Thank you so much for you help.
spen24423
 
Posts: 5
Joined: 2017-03-09 02:43

Re: Script Not Running

Postby nova_nul » 2017-03-09 05:16

Hi.
It happened to me before.
Then I found that my script was edited in windows so that it was "dos" fileformat, which cause bash can not interpret the script and reply "no such file or directory".
Try to edit the script at vim.
Then
Code: Select all
:set ff

If you got "ff=dos",then
Code: Select all
:set ff=unix
Last edited by nova_nul on 2017-03-10 09:37, edited 1 time in total.
Nice to meet you , too.
User avatar
nova_nul
 
Posts: 5
Joined: 2016-12-21 05:04

Re: Script Not Running

Postby spen24423 » 2017-03-09 20:42

Thank you!

So do I enter that in the terminal?
spen24423
 
Posts: 5
Joined: 2017-03-09 02:43

Re: Script Not Running

Postby spen24423 » 2017-03-09 21:08

I figured out how to do it but I got:

ff=unix

Since that is the case why is it not working?
spen24423
 
Posts: 5
Joined: 2017-03-09 02:43

Re: Script Not Running

Postby dasein » 2017-03-09 21:51

spen24423 wrote:chmod +x proxy-debian-linux_.sh
sudo ./proxy-debian-linux_.sh

I get the error; cannot access:"Proxy-Debian-Linux" no such file or directory. How is this? Why is this? Thank you so much for you help.

This may or may not be your problem, but either you're mistyping the name of the script when you run it, or you mistyped it in your description of your problem. (*nix filenames are case-sensitive.)

What's the ouput of
Code: Select all
ls -l
in the directory where the script lives?
User avatar
dasein
 
Posts: 7373
Joined: 2011-03-04 01:06
Location: Terra Incantationum

Re: Script Not Running

Postby pendrachken » 2017-03-10 00:11

Make sure the filesystem / area you have uploaded the script to is not mounted noexec ( for security purposes ). This is often done for public / semi public FTP upload dirs as an additional level of security.

That and as dasein said: unix / linux is generally CaSe SenSiTive.
fortune -o
Your love life will be... interesting.
:twisted: How did it know?

The U.S. uses the metric system too, we have tenths, hundredths and thousandths of inches :-P
pendrachken
 
Posts: 1250
Joined: 2007-03-04 21:10
Location: U.S.A. - WI.

Re: Script Not Running

Postby spen24423 » 2017-03-10 00:43

Thank you to all of you for the help!

This time when I uploaded the file and ran the script I still got the error, but when I ran ls -l the script name popped up in green.
spen24423
 
Posts: 5
Joined: 2017-03-09 02:43

Re: Script Not Running

Postby nova_nul » 2017-03-10 09:47

Hi.
The name of script is green because the executable file is grenn by default.
Maybe you should post what was popped up(all output of 'ls -l').
Nice to meet you , too.
User avatar
nova_nul
 
Posts: 5
Joined: 2016-12-21 05:04

Re: Script Not Running

Postby spen24423 » 2017-03-11 04:04

Ouput of "ls -l":

spencerbolling@instance-1:~$ ls -l
total 4
-rwxr-xr-x 1 spencerbolling spencerbolling 475 Mar 11 04:51 Proxy-Debian-Linux.sh

How do I check and change the mounted noexec?
spen24423
 
Posts: 5
Joined: 2017-03-09 02:43

Re: Script Not Running

Postby Dai_trying » 2017-03-11 08:57

looks like a typo in your command, you will need to type the filename correctly for it to be found including underscores (or without depending which post is correct)
Dai_trying
 
Posts: 185
Joined: 2016-01-07 12:25

Re: Script Not Running

Postby debiman » 2017-03-11 09:27

what's the output of
Code: Select all
sudo ./Proxy-Debian-Linux.sh
???
User avatar
debiman
 
Posts: 969
Joined: 2013-03-12 07:18


Return to General Questions

Who is online

Users browsing this forum: No registered users and 3 guests

fashionable