script does not work with crond
Hello,
I have a cron entry that does not work correctly but the commands work fine when I run them manually.
I have a cron entry:
##### Squid access log update
01 06 * * * /home/squid/squidaccessupdate 1> /dev/null
01 12 * * * /home/squid/squidaccessupdate 1> /dev/null
01 18 * * * /home/squid/squidaccessupdate 1> /dev/null
I then have the following script:
--snip--
#!/bin/bash
echo "Starting FTP backup move"
cd /home/squid/logs
echo "open -u mis,WatchdB 192.168.7.8
cd htdocs/datafiles/squid/logs
put access.log" > /tmp/lftp.cmds
echo "quit" >> /tmp/lftp.cmds
/usr/bin/lftp -f /tmp/lftp.cmds 2> /tmp/lftp.error
if [ "$?" == "0" ]; then
echo "File moved successfully"
#/home/friendly/email "Successfully LFTP'ed from $HOSTNAME" /dev/null
else
echo "Error ... file was not moved"
/home/friendly/email "ERROR on $HOSTNAME" /tmp/lftp.error
fi
exit
--snip--
Everytime the cron runs the script the FTP connection does not close, it will stay open until a timeout. If I run ./squidaccessupdate from the command line it works with out a problem.
Anyone got any ideas.
|