LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 05-10-2006, 01:13 PM   #1
Clemente
Member
 
Registered: Aug 2003
Distribution: Debian, Ubuntu
Posts: 188

Rep: Reputation: 30
cron: problem with perl script


Hi all,
I cannot figure it out...
I want to run dirvish-runall - a perl script for rsync backups - priodly with cron.
I inserted following line in /etc/crontab:
Code:
* * * * * root /usr/local/sbin/dirvish-expire --quiet ; /usr/local/sbin/dirvish-runall>>/root/dirvish
I see the expected output in /root/dirvish, but the script does no backup.
If I run /usr/local/sbin/dirvish-runall>>/root/dirvish directly in a bash, all works fine.
/var/log/messages shows the expected:
Code:
root@enthal1 : /usr/local/sbin : 21:11
>!tail -n15
tail /var/log/messages  -n15
May 10 21:00:01 enthal1 /usr/sbin/cron[9178]: (root) CMD ( ^I/usr/local/sbin/dirvish-expire --quiet ; /usr/local/sbin/dirvish-runall>>/root/dirvish)
May 10 21:00:13 enthal1 syslog-ng[2850]: STATS: dropped 0
May 10 21:00:15 enthal1 /usr/sbin/cron[9223]: (CRON) STARTUP (V5.0)
May 10 21:01:01 enthal1 /usr/sbin/cron[9236]: (root) CMD ( ^I/usr/local/sbin/dirvish-expire --quiet ; /usr/local/sbin/dodirvish>>/root/dirvish)May 10 21:02:01 enthal1 /usr/sbin/cron[9247]: (root) CMD ( ^I/usr/local/sbin/dirvish-expire --quiet ; /usr/local/sbin/dodirvish>>/root/dirvish)May 10 21:03:01 enthal1 /usr/sbin/cron[9259]: (root) CMD ( ^I/usr/local/sbin/dirvish-expire --quiet ; /usr/local/sbin/dodirvish>>/root/dirvish)May 10 21:04:01 enthal1 /usr/sbin/cron[9277]: (root) CMD ( ^I/usr/local/sbin/dirvish-expire --quiet ; /usr/local/sbin/dodirvish>>/root/dirvish)May 10 21:05:01 enthal1 /usr/sbin/cron[9295]: (root) CMD ( ^I/usr/local/sbin/dirvish-expire --quiet ; /usr/local/sbin/dodirvish>>/root/dirvish)May 10 21:05:01 enthal1 /usr/sbin/cron[9223]: (*system*) RELOAD (/etc/crontab)
May 10 21:06:01 enthal1 /usr/sbin/cron[9301]: (root) CMD ( ^I/usr/local/sbin/dirvish-expire --quiet ; /usr/local/sbin/dirvish-runall>>/root/dirvish)
May 10 21:07:01 enthal1 /usr/sbin/cron[9307]: (root) CMD ( ^I/usr/local/sbin/dirvish-expire --quiet ; /usr/local/sbin/dirvish-runall>>/root/dirvish)
May 10 21:08:01 enthal1 /usr/sbin/cron[9313]: (root) CMD ( ^I/usr/local/sbin/dirvish-expire --quiet ; /usr/local/sbin/dirvish-runall>>/root/dirvish)
May 10 21:09:01 enthal1 /usr/sbin/cron[9319]: (root) CMD ( ^I/usr/local/sbin/dirvish-expire --quiet ; /usr/local/sbin/dirvish-runall>>/root/dirvish)
May 10 21:10:01 enthal1 /usr/sbin/cron[9327]: (root) CMD ( ^I/usr/local/sbin/dirvish-expire --quiet ; /usr/local/sbin/dirvish-runall>>/root/dirvish)
May 10 21:11:01 enthal1 /usr/sbin/cron[9333]: (root) CMD ( ^I/usr/local/sbin/dirvish-expire --quiet ; /usr/local/sbin/dirvish-runall>>/root/dirvish)

root@enthal1 : /usr/local/sbin : 21:11
>
What can I do to get the backup job CRONolized?

Thank you,
Clemente
 
Old 05-10-2006, 02:17 PM   #2
nutthick
Member
 
Registered: Jun 2004
Distribution: Slack
Posts: 214

Rep: Reputation: 30
If
Code:
 /usr/local/sbin/dirvish-runall>>/root/dirvish
works in bash then the cronjob is just
Code:
* * * * *  /usr/local/sbin/dirvish-runall>>/root/dirvish >/dev/null 2>&1
You will need at least one of the asterisks replaced with a number, for example
Code:
1 * * * *
for every minute.

Last edited by nutthick; 05-10-2006 at 02:18 PM.
 
Old 05-10-2006, 02:52 PM   #3
Clemente
Member
 
Registered: Aug 2003
Distribution: Debian, Ubuntu
Posts: 188

Original Poster
Rep: Reputation: 30
Thank you for your suggestion. I thought, that
Code:
1 * * * * command
runs the command at 1:01, 2:01, 3:01 and so on.
Anyway, I tried it, and I tried (earlier) 0,10,20,30,40,50 for every ten minutes, too:
Same Behaviour. The script runs, but does nothing.

Clemente
 
Old 05-10-2006, 03:17 PM   #4
Clemente
Member
 
Registered: Aug 2003
Distribution: Debian, Ubuntu
Posts: 188

Original Poster
Rep: Reputation: 30
Lightbulb [Solved]

I found the solution... Quiet simple.
The dirvish script resides in /usr/local/sbin and seems to use another script from this location.
Unfortunately this directory was not in cron's $path.
I just added /usr/local/sbin to the path = stanza.
Clemente
 
Old 05-10-2006, 03:30 PM   #5
nutthick
Member
 
Registered: Jun 2004
Distribution: Slack
Posts: 214

Rep: Reputation: 30
You're right, I'm being thick
Code:
1 * * * *
would run at 1 minute past every hour.

Glad you got it sorted
 
  


Reply


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 Email Notification - Perl Script jamesyreid Programming 3 07-21-2009 08:56 AM
Problem With Script in cron.daily fizbang Linux - Newbie 10 03-21-2005 11:23 AM
Trouble with perl script in Cron job thack111 Linux - General 7 11-25-2004 03:44 AM
PPPD Script problem when cron-scheduling the script andresurzagasti Linux - Networking 0 11-24-2004 03:54 PM
cron problem with script lifetaster Linux - Newbie 3 02-24-2004 01:26 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:35 PM.

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