LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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 02-16-2012, 12:09 PM   #1
Derrick_L
LQ Newbie
 
Registered: Feb 2012
Distribution: Manjaro/Ubuntu Server
Posts: 7

Rep: Reputation: Disabled
Autoreboot


I run a CentOS 5 Server. 64 bit. I use it to run a Minecraft server. I'd like to set the entire server to reboot automatically at 2:30am every morning. How does one accomplish this?

*straight forward questions FTW*

Thanks!
 
Old 02-16-2012, 12:11 PM   #2
Cedrik
Senior Member
 
Registered: Jul 2004
Distribution: Slackware
Posts: 2,140

Rep: Reputation: 244Reputation: 244Reputation: 244
Does it have cron installed ?

If yes, just add entry in crontab for root:
Code:
30  2  *  *  *  /sbin/reboot
 
Old 02-16-2012, 04:10 PM   #3
devUnix
Member
 
Registered: Oct 2010
Posts: 606

Rep: Reputation: 59
Check crontab as simplified above for your problem.
 
1 members found this post helpful.
Old 02-17-2012, 04:06 AM   #4
Derrick_L
LQ Newbie
 
Registered: Feb 2012
Distribution: Manjaro/Ubuntu Server
Posts: 7

Original Poster
Rep: Reputation: Disabled
I have crontab installed...how would I go about setting up the autoreboot at 2:30 am??

Yes, I've tried googling lol.
 
Old 02-18-2012, 08:35 PM   #5
Derrick_L
LQ Newbie
 
Registered: Feb 2012
Distribution: Manjaro/Ubuntu Server
Posts: 7

Original Poster
Rep: Reputation: Disabled
Annnybody?
 
Old 02-18-2012, 08:54 PM   #6
uhelp
Member
 
Registered: Nov 2011
Location: Germany, Bavaria, Nueremberg area
Distribution: openSUSE, Debian, LFS
Posts: 205

Rep: Reputation: 43
"man crontab" is youre friend.
The solution is already given.
 
Old 02-18-2012, 09:10 PM   #7
Derrick_L
LQ Newbie
 
Registered: Feb 2012
Distribution: Manjaro/Ubuntu Server
Posts: 7

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by uhelp View Post
"man crontab" is youre friend.
The solution is already given.
Sigh...I guess I'll go without. Sorry for being a newbie at this Linux stuff and trying to squeeze the most out of my server.

"man crontab" tells me absolutely nothing.
 
Old 02-18-2012, 09:38 PM   #8
uhelp
Member
 
Registered: Nov 2011
Location: Germany, Bavaria, Nueremberg area
Distribution: openSUSE, Debian, LFS
Posts: 205

Rep: Reputation: 43
There usually several ways to do that.
Depending on the system.

I don't know CentOS, so my explanation is somwwhat general.

Cron is a facility every *nix offers in a way.
Each user can have a "crontab" file.
In this file each line defines a job to be run at a certain time one times or repeating.

30 2 * * * /sbin/reboot
The given line tells the crond (the deamon doing all these jobs defined by any user) to run the command "/sbin/reboot"
each 30 Minutes 2. hour on each day month and so on.

As root (as rebooting usually requires to be root) use "crontab -e"
This command gives you an editor to edit the crontab file of root in this case.
Just add this line to that file.
Leave other lines intact if any.

When saving and leaving the editor, you will get a mesage.
Something like " crontab: installing new crontab" if no crontab existed before....
 
Old 02-19-2012, 07:51 PM   #9
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,362

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
As above, the soln was given in post #2...

There's another good page on cron here http://www.adminschoice.com/crontab-quick-reference
 
Old 02-22-2012, 09:53 AM   #10
devUnix
Member
 
Registered: Oct 2010
Posts: 606

Rep: Reputation: 59
Quote:
Originally Posted by Derrick_L View Post
Sigh...I guess I'll go without. Sorry for being a newbie at this Linux stuff and trying to squeeze the most out of my server.

"man crontab" tells me absolutely nothing.
What is that you want to know? The command "man crontab" will tell you about how to use the crontab. Use it this way:

Code:
crontab -e
and enter the line given in the first reply.

Hit these keys to save and exit:

Code:
Hit Esc 

Hit : (with Shift, of course)

Hit wq
Hit Enter
To become root do this:

Code:
su -
enter the password and then run the crontab command shown above. If you are still looking for something amazing then you need to wait for a better reply.
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Autoreboot on lost DSL connection? Lenard Spencer Linux - Server 7 09-23-2007 12:09 PM

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

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