LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 04-28-2012, 05:11 AM   #1
satish
Member
 
Registered: Jan 2006
Posts: 172

Rep: Reputation: 15
System Shutdown on Saturday


I am using redhat 9 as a internet server, I had given in the crontab to shutdown my linux server at night 8:00 P.M but on saturday my office leaves on 4:00 P.M so I have to give in crontab to shutdown the server at 4:00 P.M when I am leaving at 3:00 P.M on saturday before leaving of my other employees

so I need a command which will detect the system date, when the date is detected as saturday the system will shutdown on 4:00 P.M on other days it will shutdown on 8:00 P.M

Regards

Satish
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 04-28-2012, 06:48 AM   #2
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Why do you need a "command which will detect the system date" when cron can be configured to run a command on Saturdays at 4 PM?
 
Old 04-29-2012, 11:20 PM   #3
satish
Member
 
Registered: Jan 2006
Posts: 172

Original Poster
Rep: Reputation: 15
System Shutdown on Saturday

But every saturday I have to define in the crontab for the shutdown at 4:00 P.M is there anyway to define only one time in crontab on saturday on 4:00 P.M & other days shutdown at 8:00 P.M

If it is possible please give me the crontab command

Thanks & Regards

Satish
 
Old 04-29-2012, 11:52 PM   #4
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,504

Rep: Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489
Use one crontab entry for the Monday-Friday at 8pm:

Code:
9 20 * * 1-5 command
and a second for Saturday:

Code:
0 16 * * 6 command
 
2 members found this post helpful.
Old 05-02-2012, 04:38 AM   #5
satish
Member
 
Registered: Jan 2006
Posts: 172

Original Poster
Rep: Reputation: 15
System Shutdown on Saturday

Thanks yancek

It really helpful for me.

Regards

Satish
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Cronjob - Monthly on Saturday joerilinux Linux - Newbie 4 09-18-2009 03:08 AM
Cronjob for every second Saturday of the month kinetik General 3 02-26-2009 04:56 AM
LXer: KDE-EDU 4.0 Polishing on Saturday LXer Syndicated Linux News 0 09-12-2007 11:30 AM
cron: every 3 weeks on a saturday rgiggs Slackware 19 09-26-2005 04:59 PM
System Halting while shutdown system. LiloAma Linux - Software 15 01-02-2005 08:30 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

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