LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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, 01:09 PM   #1
Derrick_L
LQ Newbie
 
Registered: Feb 2012
Distribution: Manjaro/Ubuntu Server
Posts: 6

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, 01:11 PM   #2
Cedrik
Senior Member
 
Registered: Jul 2004
Distribution: Slackware
Posts: 2,140

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

If yes, just add entry in crontab for root:
Code:
30  2  *  *  *  /sbin/reboot
 
Old 02-16-2012, 05:10 PM   #3
devUnix
Member
 
Registered: Oct 2010
Location: Bengaluru, India
Distribution: RHEL 5.1 on My PC, & SunOS / Sun Solaris, RHEL, SuSe, Debian, FreeBSD and other Linux flavors @ Work
Posts: 584

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

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, 09:35 PM   #5
Derrick_L
LQ Newbie
 
Registered: Feb 2012
Distribution: Manjaro/Ubuntu Server
Posts: 6

Original Poster
Rep: Reputation: Disabled
Annnybody?
 
Old 02-18-2012, 09: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, 10:10 PM   #7
Derrick_L
LQ Newbie
 
Registered: Feb 2012
Distribution: Manjaro/Ubuntu Server
Posts: 6

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, 10: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, 08:51 PM   #9
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,412

Rep: Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397
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, 10:53 AM   #10
devUnix
Member
 
Registered: Oct 2010
Location: Bengaluru, India
Distribution: RHEL 5.1 on My PC, & SunOS / Sun Solaris, RHEL, SuSe, Debian, FreeBSD and other Linux flavors @ Work
Posts: 584

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


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
Autoreboot on lost DSL connection? Lenard Spencer Linux - Server 7 09-23-2007 01:09 PM

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

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