[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cobalt-users] shell script for backup



On Sun, 8 Oct 2000, Jim Carey wrote:

> I've created a small script to do a backup of some files (based on Steve
> Werby post):
> 
> #!/bin/sh
> tar -cpvz -f /home/mybackups/daily/backup.sites_1-9-`date +%Y-%m-%d`.tar.gz
> /home/sites/site[1-9]/
> tar -cpvz -f /home/mybackups/daily/backup.sites_10-19-`date
> +%Y-%m-%d`.tar.gz /home/sites/site1?/
> ls -aR1 --full-time / > /home/ref/file_list.txt
> tar -cpvz -f /home/mybackups/daily/backup.file_list-`date +%Y-%m-%d`.tar.gz
> home/sites/file_list.txt/
> tar -cpvz -f /home/mybackups/daily/backup.spool-`date +%Y-%m-%d`.tar.gz
> /home/spool/
> tar -cpvz -f /home/mybackups/daily/backup.root-`date +%Y-%m-%d`.tar.gz
> /root/
> tar -cpvz -f /home/mybackups/daily/backup.named-`date +%Y-%m-%d`.tar.gz
> /etc/named/
> tar -cpvz -f /home/mybackups/daily/backup.httpd_conf-`date +%Y-%m-%d`.tar.gz
> /etc/httpd/conf/
> cp /etc/aliases.addon /home/mybackups/daily/aliases.addon-`date +%Y-%m-%d`
> cp /etc/sendmail.cw /home/mybackups/daily/sendmail.cw-`date +%Y-%m-%d`
> cp /etc/sendmail.cf /home/mybackups/daily/sendmail.cf-`date +%Y-%m-%d`
> cp /etc/virtusertable /home/mybackups/daily/virtusertable-`date +%Y-%m-%d`
> 
> i've put it in /usr/local/sbin - it has chmod of 755 - it has chown of
> root.root
> -rwxr-xr-x   1 root     root          934 Oct  7 12:15 myback
> 
> when I try to execute it using /usr/local/sbin/myback it says :
> 
> [root@web ref]# /usr/local/sbin/myback
> sh: /usr/local/sbin/myback: No such file or directory

The first line of the shell script defines the interpreter that will run
the script. I suspect you have edited the file on an MSDOS/Windows based
system and ftp'd it to the server in binary mode. The system will be
looking for a shell called '/bin/sh^M' with a control M character at the
end of the line.

> 
> what am I doing wrong ?
> 
> I can run it successfully as a php4 cgi by wrapping the commands in an
> exec - but I just want to figure out my simple mistake - whatever it is
>