LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 04-20-2006, 04:02 PM   #1
ballistic509
Member
 
Registered: Feb 2006
Distribution: CentOS
Posts: 114

Rep: Reputation: 15
Cron to reboot server?


can anyone help me in making a cron job that debian will follow to reboot my server every midnight?
 
Old 04-20-2006, 04:12 PM   #2
reddazz
LQ Guru
 
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298

Rep: Reputation: 77
0 0 * * * shutdown -r now
 
Old 04-20-2006, 04:14 PM   #3
ballistic509
Member
 
Registered: Feb 2006
Distribution: CentOS
Posts: 114

Original Poster
Rep: Reputation: 15
is that exactly how i would enter it into shell? and it will store itself?
 
Old 04-20-2006, 04:14 PM   #4
pljvaldez
LQ Guru
 
Registered: Dec 2005
Location: Somewhere on the String
Distribution: Debian Wheezy (x86)
Posts: 6,094

Rep: Reputation: 281Reputation: 281Reputation: 281
Just out of curiosity, why do you want to reboot every night? I thought that generally that's one of the great things about linux, that you can restart only the services that you need to and don't have to cycle the hardware.
 
Old 04-20-2006, 04:22 PM   #5
ballistic509
Member
 
Registered: Feb 2006
Distribution: CentOS
Posts: 114

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by pljvaldez
Just out of curiosity, why do you want to reboot every night? I thought that generally that's one of the great things about linux, that you can restart only the services that you need to and don't have to cycle the hardware.
im hosting a site on a..lets say "very crappy" system known to me and friends as the DynoComp..its a piece of shit but the only extra box i have..and i dont know how long it can really go untill it needs rebooting lol..below is system info LMAO

Code:
  CPU model AMD-K6tm w/ multimedia extensions 
  CPU MHz 212.99 
  CPU cache 64 KB 
  CPU bogomips 424.34
Code:
 Total RAM 53.24 MB
 Total Used 52.13 MB
 Swap 156.84 MB
 Swap Used 1.36 MB

Last edited by ballistic509; 04-20-2006 at 04:31 PM.
 
Old 04-20-2006, 04:43 PM   #6
ataraxia
Member
 
Registered: Apr 2006
Location: Pittsburgh
Distribution: Debian Sid AMD64
Posts: 296

Rep: Reputation: 30
Quote:
Originally Posted by ballistic509
is that exactly how i would enter it into shell? and it will store itself?
You need to add that line to the bottom of /etc/crontab. Once you put it there, it will stay until you take it away.
 
Old 04-20-2006, 04:46 PM   #7
pljvaldez
LQ Guru
 
Registered: Dec 2005
Location: Somewhere on the String
Distribution: Debian Wheezy (x86)
Posts: 6,094

Rep: Reputation: 281Reputation: 281Reputation: 281
Generally the way to edit the crontab is to become root and type crontab -e which will bring up your default text editor (mine is nano, but you might have vi, emacs, etc). Then enter the line somewhere, save, and exit.
 
Old 04-20-2006, 04:46 PM   #8
ballistic509
Member
 
Registered: Feb 2006
Distribution: CentOS
Posts: 114

Original Poster
Rep: Reputation: 15
thanks ataraxia
 
Old 04-20-2006, 05:15 PM   #9
reddazz
LQ Guru
 
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298

Rep: Reputation: 77
Quote:
Originally Posted by ballistic509
thanks ataraxia
You need to do as pljvaldez suggested (use crontab -e) because you can mess up your cron files if you edit them directly.
 
Old 04-20-2006, 05:30 PM   #10
ataraxia
Member
 
Registered: Apr 2006
Location: Pittsburgh
Distribution: Debian Sid AMD64
Posts: 296

Rep: Reputation: 30
Quote:
Originally Posted by reddazz
You need to do as pljvaldez suggested (use crontab -e) because you can mess up your cron files if you edit them directly.
Most versions of the crontab program don't support /etc/crontab, but only the tabs in /var/cron/tabs . /etc/crontab is the exception to your normally correct rule.
 
Old 04-22-2006, 07:34 AM   #11
anindyanuri
Member
 
Registered: Jan 2005
Location: India
Distribution: Kubuntu Gutsy
Posts: 450

Rep: Reputation: 30
Quote:
Originally Posted by reddazz
You need to do as pljvaldez suggested (use crontab -e) because you can mess up your cron files if you edit them directly.
and how do i remove a previously entered cron job? also it will be helpful if you refer me a site to know more about cron job.

regards
anindyanuri
 
Old 04-22-2006, 09:45 AM   #12
ataraxia
Member
 
Registered: Apr 2006
Location: Pittsburgh
Distribution: Debian Sid AMD64
Posts: 296

Rep: Reputation: 30
Quote:
Originally Posted by anindyanuri
and how do i remove a previously entered cron job?
You just need to remove the line that you put in.
 
Old 04-23-2006, 12:22 PM   #13
anindyanuri
Member
 
Registered: Jan 2005
Location: India
Distribution: Kubuntu Gutsy
Posts: 450

Rep: Reputation: 30
Quote:
Originally Posted by ataraxia
You just need to remove the line that you put in.
Please watch the Reddaz's post, and the advised not to mess up the file with direct editing itself.

regards
anindyanuri
 
  


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
Fedora i686/2.4.27-0.3um - Server hostname reverts to original upon server reboot foxhosting Linux - Newbie 2 02-25-2006 03:39 AM
Using Cron to start software on reboot Azalar Linux - Newbie 3 01-12-2006 04:41 AM
cron reboot problem tcpdump Linux - Software 3 05-14-2004 06:05 AM
Cron Reboot Virtus Linux - Software 3 01-13-2003 07:42 AM
Using cron to start a program at reboot ? s&j Linux - General 2 06-22-2002 04:31 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

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