problem with bash script

Paolo De Michele paolo at paolodemichele.it
Sat Mar 8 17:34:20 UTC 2014


On Saturday, March 08, 2014 05:07:17 PM Hans Muecke wrote:
> Am 08.03.2014 16:56, schrieb Paolo De Michele:
> 
> Hi Paolo,
> 
> Just a wild guess ... does the cron start "./script.sh" or
> "/path/to/script.sh"? The latter one should be used, if the script is
> not located in you $PATH.
> 
> > <pre wrap>
> > 
> > hi everybody,
> > 
> > I have a problem with my bash script.
> > this script will do a backup in a particular directory - look below:
> > 
> > #
> > 
> > BCK_FILE=/backup/www/test
> > destinatario=alert at piludu.it
> > 
> > sites=("client1/web1" "client1/web2")
> > sito=("1" "2")
> > 
> > tLen=${#sites[@]}
> > 
> > for (( i=0; i<${tLen}; i++ ));
> > do
> > 
> > cd /var/www/clients/
> > cp -R ${sites[$i]} /backup/temp/www/
> > cd /backup/temp/www/
> > 
> > tar cfz `date +%F`_web${sito[$i]}.tar.gz web${sito[$i]}/
> > 
> > mv *.tar.gz /backup/www/test/
> > 
> > rm -rf /backup/temp/www/*
> > 
> > done
> > 
> > 
> > if I start this script.sh in my console
> > # ./script.sh it works
> > but if I schedule it in my crontab doesn't work
> > 
> > what is the problem?
> > can I fix it?
> > 
> > thanks in advance
> > regards
> > 
> > 
> > </pre></body>
> > </html>
> > </html>

I get no error message, but when I go to check if backups have been made the 
next day there aren't inside the folder.

my crontab is:

00 01 * * * /path/script/file.sh > /dev/null 2>&1

when I run the script I am inside the folder where it resides
 if I control syslog file I see that the script have been executed

any idea?




More information about the ubuntu-users mailing list