LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 01-01-2005, 09:26 PM   #1
jordanthompson
Member
 
Registered: Oct 2004
Posts: 115

Rep: Reputation: 15
cron weekly does not run


Hi there,
my cron.daily always mails me that it has run (at least it tells me any errors that occured...) I added a new cron.weekly script, but it never runs. I can run it from the command line no problem, but not from cron.daily.

Here is my /etc/crontab:
# run-parts
01 * * * * root run-parts /etc/cron.hourly
02 4 * * * root run-parts /etc/cron.daily
22 4 * * 0 root run-parts /etc/cron.weekly
42 4 1 * * root run-parts /etc/cron.monthly



Here is the offending script:
#!/bin/tcsh
/bin/mount /mnt/rev

# Remove the oldest MyDocuments:
rm -f `ls -ltr /mnt/rev/MyDocuments-*tar.gz | awk '{if (NR == 1) { print $9; exit;}}'`

# Remove the oldest www:
rm -f `ls -ltr /mnt/rev/www-*tar.gz | awk '{if (NR == 1) { print $9; exit;}}'`

/bin/tar zpcf /mnt/rev/MyDocuments-`date +"%y-%m-%d"`.tar.gz \
/export/MyDocuments/alex \
/export/MyDocuments/serena \
/export/MyDocuments/jordan \
/export/MyDocuments/mojgan \
/export/MyDocuments/pictures

/bin/tar zpcf /mnt/rev/www-`date +"%y-%m-%d"`.tar.gz \
/var/www/cgi-bin \
/var/www/html \
/var/www/httpd \
/var/www/icons \
/var/www/perl

/bin/umount /mnt/rev
/usr/bin/eject /mnt/rev


I have copied this script to my cron.daily to see if it runs there (I feel confident it will as I have similar scripts there already.)

Anyone have any suggestions?
 
Old 01-01-2005, 09:42 PM   #2
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 61
Nix that idea

Last edited by homey; 01-01-2005 at 09:49 PM.
 
Old 01-01-2005, 10:13 PM   #3
Scruff
Member
 
Registered: Oct 2002
Location: Stoughton, MA
Distribution: Gentoo x86_64 & PPC
Posts: 949

Rep: Reputation: 30
Why all the extra stuff in there? If you want it to run as root, be root and edit roots crontab. Here is a backup script I run nightly as root via cron:

0 3 * * * /usr/local/sbin/backup.sh

Try leaving out ''root run-parts', unless the errors seem related to the script (though it looks ok with a quick glance..) Posting the exact error would help

Last edited by Scruff; 01-01-2005 at 10:14 PM.
 
Old 01-01-2005, 10:34 PM   #4
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 61
Quote:
#!/bin/tcsh
/bin/mount /mnt/rev
Didn't you leave out part of the command?
like /bin/mount /dev/hdb1 /mnt/rev or similar
 
Old 01-01-2005, 10:38 PM   #5
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
Quote:
Originally posted by homey
Didn't you leave out part of the command?
like /bin/mount /dev/hdb1 /mnt/rev or similar
Not if its in his fstab file..
 
Old 01-01-2005, 10:41 PM   #6
Scruff
Member
 
Registered: Oct 2002
Location: Stoughton, MA
Distribution: Gentoo x86_64 & PPC
Posts: 949

Rep: Reputation: 30
Not if he has /mnt/rev defined in his /etc/fstab

/dev/hdX /mnt/rev FS OPTIONS 0 0
 
Old 01-01-2005, 10:42 PM   #7
Scruff
Member
 
Registered: Oct 2002
Location: Stoughton, MA
Distribution: Gentoo x86_64 & PPC
Posts: 949

Rep: Reputation: 30
LOL! What's up Trickykid? Long time no hear Hope to see you at LW Boston this year!
 
Old 01-01-2005, 11:00 PM   #8
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 61
Quote:
Not if he has /mnt/rev defined in his /etc/fstab
That's true but I'm abit confused as to what /mnt/rev refers to as he has an eject statement at the end. Thought that goes with a cdrom device and I don't see anything for writing to a cdrom.

Edit: and a tape device would normally be something like /dev/st0 or /dev/nst0
Also, one might expect to see a rewind command in there somewhere.

/bin/umount /mnt/rev
/usr/bin/eject /mnt/rev


Aside from that, did you remember to make the script executable?

Last edited by homey; 01-01-2005 at 11:20 PM.
 
Old 01-02-2005, 03:11 PM   #9
jordanthompson
Member
 
Registered: Oct 2004
Posts: 115

Original Poster
Rep: Reputation: 15
Thanks for all of the interest in this post... :-)

Yes, /mnt/rev is in my /etc/fstab so I don't have to specify the device
Yes the script is executable - in fact, I put a copy of the script in /etc/cron.daily and it ran along with the rest of the daily scripts.

It all boils down to run-parts not firing on the weekly cron. I compared my crontab with others on the net and it is identical - at least to these old eyes :P

thanks again for your help,
Jordan
 
Old 01-02-2005, 04:53 PM   #10
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
Quote:
Originally posted by Scruff
LOL! What's up Trickykid? Long time no hear Hope to see you at LW Boston this year!
So far I should be there..
 
Old 01-02-2005, 09:39 PM   #11
jordanthompson
Member
 
Registered: Oct 2004
Posts: 115

Original Poster
Rep: Reputation: 15
/mnt/rev is an iomega rev drive - 33GB (yup GB) removable disk.
 
Old 01-03-2005, 01:14 AM   #12
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 61
Maybe if the scripts are similar enough, you could run diff file1 file2 and see if linux will point out anything strange.
 
Old 01-04-2005, 08:55 AM   #13
jordanthompson
Member
 
Registered: Oct 2004
Posts: 115

Original Poster
Rep: Reputation: 15
Is no-one else having problems with cron.weekly not running?
 
Old 01-04-2005, 11:27 AM   #14
jordanthompson
Member
 
Registered: Oct 2004
Posts: 115

Original Poster
Rep: Reputation: 15
Can someone please post a crontab that is known to run the weekly cron? This way I can do a diff on a known entity.

thanks,
Jordan
 
Old 01-04-2005, 01:33 PM   #15
wipe
Member
 
Registered: Jun 2004
Location: High Green
Distribution: Fedora Core 4
Posts: 180

Rep: Reputation: 30
Your crontab looks fine to me. How about putting some other directory in the weekly line like this:

22 4 * * 0 root run-parts /etc/cron.daily

or

22 4 * * 0 root run-parts /etc/cron.adhoc

Or try adjusting the time to make it run daily or whatever. (Those numbers say: "run every sunday at 4:22 in the morning.") This way you can determine whether it's your cron or your filesystem that's causing the problem.

Maybe that 0 needs to be 7 or some extra script needs to be in every "run-parts" directory. What distro are you using?

Simon
 
  


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
Apache crash on cron->logrotate (weekly) pezzer55 Linux - Software 7 09-30-2008 07:58 PM
how do I rsync & cron to fetch -current weekly? chess Slackware 3 09-11-2005 10:07 AM
Weekly Cron problem sopiaz57 Linux - General 2 11-15-2004 11:46 AM
trying to get cron to run naijaguy Linux - General 12 08-18-2004 05:32 PM
how to run this cron job ashley75 Linux - General 5 05-24-2004 11:20 AM

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

All times are GMT -5. The time now is 09:28 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