LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


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

Rep: Reputation: 15
Unhappy 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.
 
Old 03-15-2004, 01:27 PM   #2
horndude
Member
 
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
michael_util
Member
 
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
quit

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

Original Poster
Rep: Reputation: 15
Hello,

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

Michael.
 
  


Reply



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

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

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

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