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. |
Add a line at the end to close the connection.
|
The script works when I execute it, the lftp.cmds command file, which holds all the commands that get run has the following:
open -u username,password IP cd htdocs/datafiles/squid/logs put access.log quit So the connection does get closed. |
Hello,
I removed the "exit" from the bottem of the script and it seemed to fix the issue. Michael. |
All times are GMT -5. The time now is 08:06 PM. |