Made command into a script but now won't run


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Made command into a script but now won't run
# 1  
Old 06-13-2007
Made command into a script but now won't run

Hello,

After seeing in a Unix cheatsheet that I could add commands into a file and run that file as a command to save on typing, i tried it with this:

Code:
#! /bin/csh
# Backup website excluding directories that do not change
rsync -e "ssh -p 2222" -axzvc --progress --stats --compress-level=9 patwa@patwanet.co.uk:/home/patwa --exclude=/home/patwa/public_html/dl --exclude=/home/patwa/public_html/jithwish --exclude/home/patwa/public_html/senaka /home/H/HGBackup13062007 ; sync

I gave it a chmod of 755 and no file extension but when I try to run it I get 'Command not found'. The file was placed in my cygwin home directory.

I can run the actual rsync command if I type it longhand with no problem.

Could someone advise what I'm doing wrong?

Thanks.

H.
# 2  
Old 06-13-2007
Patwa,
Try the following:
Code:
which rsync
which <your_shell>
echo $PATH

# 3  
Old 06-13-2007
I'm sorry, I don't follow.

Could you possibly demonstrate using the command I gave at the top, it has all the info there - I'm rsync'ing from my webhost to my local machine.

Default shell is bash, although I can also use tcsh.

Thanks.

H.
# 4  
Old 06-13-2007
Try

Code:
cd
./myscript

or

Code:
~/myscript

or

Code:
$HOME/myscript

or

Code:
PATH=$PATH:$HOME
myscript

# 5  
Old 06-13-2007
Absolutely nothing happens. I just get the command prompt again, no action, no login prompt, nothing.
# 6  
Old 06-13-2007
replace first line with

Code:
#!/bin/sh -x

# 7  
Old 06-13-2007
Hi, thanks. that works.

May I ask out of curiosity what the /bin/sh -x does? Is the -x to make it an executable? And what is the /bin/sh?

Also, please could someone help with the rsync command itself?

--exclude=/home/patwa/public_html/dl is not working. It's downloading the directory anyway and as it's over 1GB and doesn't change I'd like to exclude it.

I tried --exclude=/home/patwa/public_html/dl/ as well but no joy.

Thanks.

H.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Bash script won't run because hardware won't produce display

Can anyone offer any advice on how to modify the script below to work on a new system we have, that has no graphics capability? We admin the system through a serial RAS device. I've tried running the below script through the RAS and through an ssh -X session. It failed with something like "GTK... (3 Replies)
Discussion started by: yelirt5
3 Replies

2. Shell Programming and Scripting

While read won't run keyboard function

I am using while read do/ done to retrieve menu item. Works as advertised, no problem. I am using this hack function "pause" to stop script execution and wait for keyboard "enter" key to continue. Sort of break point function. Also works fine with one exception - it does not work when used... (4 Replies)
Discussion started by: annacreek
4 Replies

3. Shell Programming and Scripting

Script for telnet and run one command kill it and run another command using while loop

( sleep 3 echo ${LOGIN} sleep 2 echo ${PSWD} sleep 2 while read line do echo "$line" PID=$? sleep 2 kill -9 $PID done < temp sleep 5 echo "exit" ) | telnet ${HOST} while is executing only command and exits. (5 Replies)
Discussion started by: sooda
5 Replies

4. Shell Programming and Scripting

how to run an already made script run against a list of ip addresses solaris 8 question

how to run an already developed script run against a list of ip addresses solaris 8 question. the script goes away and check traffic information, for example check_GE-VLANStats-P3 1.1.1.1 and returns the results ok. how do I run this against an ip list? i.e a list of 30 ip addresses (26 Replies)
Discussion started by: llcooljatt
26 Replies

5. Solaris

SunFire V440 Quad gigabit ce1 won't run Gig

Hi there. My first time posting so apologies for any indescretions in advance. :o I've got two SunFire V440 servers running Solaris 5v10. Both have a quad Gigabit ethernet card fitted, both have the same symptom; that is, I can't get the first port ce1 to run Gigabit. Motherboard ports are ce0 and... (10 Replies)
Discussion started by: fixit9660
10 Replies

6. UNIX for Dummies Questions & Answers

tip: Simple script won't run in cygwin - vim editor involved

I ran into this issue and thanks to various postings in various forums, was able to figure out the solution but didn't see one posting that laid the whole issue out cleanly. So thought the following might help others ... ------------------------------------------------------------------------... (2 Replies)
Discussion started by: oxysep
2 Replies

7. Ubuntu

Toshiba Laptop Won't Run Bluetooth with Ubuntu

I am running Ubuntu 8.1 on a Toshiba Satellite P105-S9337 with built-in Bluetooth hardware. I cannot get the Bluetooth hardware to work with my Microsoft Bluetooth mouse. I have installed the tosh software with no luck. Does anyone have an idea as to what to try. I have several kernel mods... (0 Replies)
Discussion started by: tjloeb
0 Replies

8. Solaris

smc won't run on a regular user

Hi All, I'm getting this all the time with a regular user (after I do su - and smc): It appears you are attempting to run the graphical Solaris Management Console from a terminal which does not have a suitable 'DISPLAY' environment. Please check your 'DISPLAY' settings and that the user... (5 Replies)
Discussion started by: itik
5 Replies

9. UNIX for Dummies Questions & Answers

Cron won't run properly

I am new to unix, and this is my 1st post on this board. Looking for some advice about a cron job in my server. I am running a cron task that references a script which runs several other scripts and compiles them into a report and emails it to me. If I run the script manually, I will... (2 Replies)
Discussion started by: Steeler_fan
2 Replies

10. UNIX for Dummies Questions & Answers

Why won't my script run?

On the following script that I get an error when I try to execute as root: #./mv_log.sh bash: /root/util/mv_log.sh: Permission denied #!/usr/bin datetag=`date --date='1 day ago' +"%b%d%Y"` logname=`find /opt/bea/wlserver6.1/config/*/logs/ -iname 'access.log0*' -mtime -1 -print` mv... (4 Replies)
Discussion started by: darthur
4 Replies
Login or Register to Ask a Question