Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Slackware This Forum is for the discussion of Slackware Linux.


Search this Thread
Old 03-15-2004, 12:29 PM   #1
Registered: Feb 2004
Posts: 47

Rep: Reputation: 15
Unhappy script does not work with crond


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:

echo "Starting FTP backup move"

cd /home/squid/logs

echo "open -u mis,WatchdB
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
echo "Error ... file was not moved"
/home/friendly/email "ERROR on $HOSTNAME" /tmp/lftp.error


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.
Old 03-15-2004, 01:27 PM   #2
Registered: Sep 2003
Posts: 43

Rep: Reputation: 15
Add a line at the end to close the connection.
Old 03-15-2004, 01:58 PM   #3
Registered: Feb 2004
Posts: 47

Original Poster
Rep: Reputation: 15
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

So the connection does get closed.
Old 03-15-2004, 02:04 PM   #4
Registered: Feb 2004
Posts: 47

Original Poster
Rep: Reputation: 15

I removed the "exit" from the bottem of the script and it seemed to fix the issue.



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
cron spawning extra crond - script fails jbob75 Linux - Software 2 11-21-2005 04:29 AM
crond wont' work! compu73rg33k Linux - Software 1 08-18-2004 11:40 AM
more than one instance of crond plisken Slackware 2 04-18-2004 12:30 PM
Crond jimval7 Linux - General 2 03-06-2002 11:28 AM
Shutting up Crond mikeyt_333 Linux - General 9 12-03-2001 12:46 PM

All times are GMT -5. The time now is 12:00 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration