LinuxQuestions.org
Help answer threads with 0 replies.
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 06-15-2012, 05:02 PM   #1
rjo98
Senior Member
 
Registered: Jun 2009
Location: US
Distribution: RHEL, CentOS
Posts: 1,697

Rep: Reputation: 48
How to cron a shutdown -rF now


I have a server that I'm hoping to replace soon, but for now i have to reboot and e2fsck it every couple days to avoid general weirdness. Instead of doing it remotely in the early hours of the morning, is there a way to cron a "shutdown -rF now" to run a few times a week at a time of my choosing?

i dont know if its a simple as doing
00 12 * * 1,3,5 shutdown -rF now

or there's more to it or a better way.
 
Old 06-15-2012, 05:15 PM   #2
montel
Member
 
Registered: Jun 2012
Location: Canada
Distribution: Ubuntu/Debian/CentOS
Posts: 45

Rep: Reputation: 18
I am not sure if there is a better way, but you may want to go to the full path:

00 12 * * 1,3,5 /sbin/shutdown -rF now

Let me know how it goes. And if others have a better way, I would like to hear it too
 
1 members found this post helpful.
Old 06-15-2012, 05:16 PM   #3
rjo98
Senior Member
 
Registered: Jun 2009
Location: US
Distribution: RHEL, CentOS
Posts: 1,697

Original Poster
Rep: Reputation: 48
yeah, probably a good call using the full path. thanks. wonder if anyone else has a better way too.
 
Old 06-18-2012, 09:06 PM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,374

Rep: Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383
1. if you're having to e2fsck every few days, I REALLY hope you've got backups; sounds like your disk(s) are very nearly dead.
2. to automate this, you'll probably need to edit http://linux.die.net/man/5/e2fsck.conf to force it to continue where it would normally stop and ask the user ... see eg '-y' http://linux.die.net/man/8/e2fsck
 
1 members found this post helpful.
Old 06-19-2012, 02:18 AM   #5
rjo98
Senior Member
 
Registered: Jun 2009
Location: US
Distribution: RHEL, CentOS
Posts: 1,697

Original Poster
Rep: Reputation: 48
oh yeah, definitely have a backup. it's not that the file system get corrupt, but I think its more the controller card dying a slow death, so it does some weird stuff, and i just want to keep making sure the file system is in tact until it can be replaced. thanks Chris.
 
  


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
Delaying shutdown while cron job is running bitpicker Linux - General 7 05-19-2009 06:35 AM
shutdown server with cron??? shahz Red Hat 5 11-26-2008 01:55 AM
shutdown only if no cron jobs are running Red Squirrel Linux - Software 4 08-31-2005 01:00 PM
Combine cron with shutdown? jeopardyracing Linux - Newbie 3 11-13-2004 01:56 PM
shutdown cron job tapanga Linux - Newbie 1 06-08-2004 12:17 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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