LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 11-25-2008, 10:09 PM   #1
byng08
LQ Newbie
 
Registered: Apr 2008
Posts: 4

Rep: Reputation: 0
Red face Why my cron job doesn't work


Hi,
Juz funny, this cron job which shut down the machine use to work before but now is not, what went wrong ?

However, when execute the shutdown command it works.
Thank you.

byng08
 
Old 11-25-2008, 10:15 PM   #2
centos82
Member
 
Registered: Sep 2008
Distribution: CentOS
Posts: 75

Rep: Reputation: 16
What user is the cron job setup for? Can you provide the output of crontab -l for that user. Also, why would you want a cronjob to shutdown your server?
 
Old 11-25-2008, 10:33 PM   #3
byng08
LQ Newbie
 
Registered: Apr 2008
Posts: 4

Original Poster
Rep: Reputation: 0
Hi,
The output is as below :
35 17 * * 5-7 sync; /sbin/shutdown -h +3 "server shutting down by cron job in 3 minutes time ..."

Is a routine for us to shut down the server during weekend.
 
Old 11-25-2008, 11:32 PM   #4
rnturn
Member
 
Registered: Jan 2003
Location: Illinois (Chicago area)
Distribution: Red Hat (8.0), SuSE (10.x, 11.x, 12.2, 13.2), Solaris (8-10), Tru64
Posts: 982

Rep: Reputation: 53
Quote:
35 17 * * 5-7 sync; /sbin/shutdown -h +3 "server shutting down by cron job in 3 minutes time ..."
I think what centos82 is alluding to is that you need to be root or a some other user specifically authorized to execute the shutdown command. Your cron job may be working fine but the shutdown command would be erroring out if the user doesn't have the authority to perform a shutdown. You should have received an email from the cron daemon that would show if any errors occurred.

And I just have to ask: If you're shutting the system down for the weekend (presumably on Friday, i.e. day "5") why would you need to specify Saturday and Sunday.


--
Rick
 
Old 11-25-2008, 11:46 PM   #5
yzhong
Member
 
Registered: Jun 2007
Location: sydney
Distribution: redhat , ubuntu, centos
Posts: 56

Rep: Reputation: 16
You can check /var/log/cron to see if that cron job really run, plus run by which user
 
Old 11-26-2008, 02:00 AM   #6
byng08
LQ Newbie
 
Registered: Apr 2008
Posts: 4

Original Poster
Rep: Reputation: 0
Hi,
I think I found the error already, the message is not completely type. So soory for sending the wrong output as well.

Thank you.
 
Old 11-26-2008, 02:04 AM   #7
SqdnGuns
Member
 
Registered: Aug 2005
Location: Fountain Valley, CA / Thailand
Distribution: Slackware64 14.0
Posts: 981

Rep: Reputation: 88
Question

Quote:
Originally Posted by byng08 View Post
Hi,
I think I found the error already, the message is not completely type. So soory for sending the wrong output as well.

Thank you.
So what was the actual error and how did you fix it?
 
Old 11-26-2008, 02:17 AM   #8
byng08
LQ Newbie
 
Registered: Apr 2008
Posts: 4

Original Poster
Rep: Reputation: 0
This message is from the log :
sync; /sbin/shutdown -h +3 "server shutting down by cron job in 3 minut)

Notice that the 3 minut is not completely type.

Thank to all who try to help.
 
  


Reply

Tags
cronjobs


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
adding a perl script to cron.daily / cron.d to setup a cron job CrontabNewBIE Linux - Software 6 01-14-2008 09:16 AM
cron job somsahi Linux - Software 9 10-05-2006 03:19 PM
How do I get a cron job to work? socceroos Linux - Software 2 03-23-2006 05:22 PM
cron job wbatzle Linux - Newbie 2 07-12-2005 05:19 PM
cron job? luap Linux - Software 2 03-16-2003 09:48 AM


All times are GMT -5. The time now is 11:44 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration