LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
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 07-28-2005, 01:09 PM   #1
kum4363
LQ Newbie
 
Registered: Jul 2005
Posts: 1

Rep: Reputation: 0
How to reboot linux machine automatically


How do I perfom a unattended linux reboot at a particular time- say at 10 p.m. every night.
Will the command "shutdown -h 22:01 -r now" work? If not what is the right command. Thanks
 
Old 07-28-2005, 01:29 PM   #2
LuggerHouse
Member
 
Registered: May 2004
Location: Montreal,QC,Canada
Distribution: Fedora Core 7
Posts: 208

Rep: Reputation: 30
You better use the /etc/cron.daily directory..

Simply create a script with
shutdown -r now

and place it there. I will be executed ad per crontab entry for the daily directory.

HTH
LuggerHouse
 
Old 07-28-2005, 02:58 PM   #3
halo14
Senior Member
 
Registered: Apr 2004
Location: Surprise, AZ
Distribution: Debian | CentOS | Arch
Posts: 1,103

Rep: Reputation: 45
yeah.. that will work.. but umm... why are you wanting reboot daily?? Are you new to Linux/Unix?? These systems won't slow down from being turned on for long periods of time.. the only thing that isn't hardware related that you NEED to reboot Linux for is if you install a new kernel, you have to reboot in order to load the new kernel..
 
Old 07-28-2005, 03:18 PM   #4
Matir
Moderator
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Ubuntu
Posts: 8,507

Rep: Reputation: 118Reputation: 118
Or you could accomplish it like so:
Code:
ln -s /sbin/reboot /etc/cron.daily/reboot


No scripts needed.
 
Old 07-28-2005, 07:36 PM   #5
J.W.
LQ Veteran
 
Registered: Mar 2003
Location: Milwaukee, WI
Distribution: Mint
Posts: 6,642

Rep: Reputation: 69
Automating a reboot is not hard to do, but the important point really is "Why would a daily reboot be necessary?" Unlike Windows, which is prone to becoming unstable the longer it has been runnning, Linux can easily run for months if not years without a reboot. (At least for me, the only time I need to reboot is when I need to switch over to Windows on my dual boot machine). As halo14 mentioned, there are not many situations where a reboot in Linux is truly required.

Is your question really more related to how to set up an automated task (and is just using the reboot simply as an example) or is there some sort of problem that you are hoping that a reboot will solve? -- J.W.
 
Old 07-28-2005, 09:05 PM   #6
perfect_circle
Senior Member
 
Registered: Oct 2004
Location: Athens, Greece
Distribution: Slackware, arch
Posts: 1,783

Rep: Reputation: 52
Actually according to my experience, after a period of time, linux runs faster that in the beginning.
Linux utilizes the RAM in a very efficient way. SO it tries to make use of all the RAM you have and the stuff you load in RAM will stay there unless you need the space. So applications like firefox that may need 3-4 second to load the first time will load pretty fast next time. I don't have a server, but I tend to leave my box switched on for weeks and never had a problem. The only time you need to reboot is when you load a new kernel.
For anything else you may need to switch yo run level 1, and install it, but rebooting is almost never necessary.

*EDIT*
If you experience slow downs in most cases it's a memory leak or a bug in one of your programs and tool like "top" or "htop" will help you determine and kill/unload the buggy application.

Last edited by perfect_circle; 07-28-2005 at 09:10 PM.
 
Old 07-29-2005, 01:56 AM   #7
enemorales
Member
 
Registered: Jul 2004
Location: Santiago, Chile
Distribution: Ubuntu
Posts: 410

Rep: Reputation: 30
May I ask the complementary question: If you dont need your machine turned on during night, why should you do so?
 
Old 07-29-2005, 02:18 AM   #8
grimse
Member
 
Registered: Oct 2004
Location: Oldenburg, Germany
Distribution: FC4
Posts: 42

Rep: Reputation: 15
you also can use crontab. simply login as su, type '/usr/bin/crontab -e', set a time and the comand. for 10 p.m. its:
0 22 * * * /usr/bin/shutdown -r now

grim
 
Old 07-29-2005, 01:51 PM   #9
hakukani
Member
 
Registered: Jun 2005
Location: Big Island, hawaii
Distribution: fc5; OS X tiger
Posts: 48

Rep: Reputation: 15
enemorales-

Linux boxes run their daily cron scripts early in the morning--I think the default is 2:30 am-?...

In general, though, most electronic devices run better and more reliably the more they are left on. Powering on and off eventually will stress the components of the power supply, making it more likely to fail. In Hawaii, or any humid environment, the corrosion level is very high. I leave all of my electronic equipment on most of the time, and I find that I have much less corrosion.

I have a twenty-two year old audiophile stereo system that has rarely been shut off; a Kurzweil keyboard, and various audio hardware that has rarely been turned off in five years; a pII from mid-1998 that has never had a hardware problem [ok, the windmodem kacked, so I had to replace it with a better one] (my server), plus some newer boxes. Only my laptop gets regularly powered up and down, because I transport it from work to home daily.


my $.02
 
  


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
Ubuntu won't reboot automatically Marrea Ubuntu 0 07-22-2005 04:25 AM
startup backup agent automatically when reboot ashley75 Linux - General 1 07-18-2005 03:39 PM
Want to refresh Samba shares automatically after Windows reboot evdm Linux - Software 2 03-08-2005 04:59 PM
Gnome failed to start automatically on reboot moacirponti Red Hat 0 09-08-2004 04:00 PM
device icons created automatically after reboot mushmaster Linux - Newbie 2 08-14-2004 07:00 PM


All times are GMT -5. The time now is 06:05 AM.

Main Menu
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