LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 03-15-2007, 11:41 AM   #1
ThaHabbis
Member
 
Registered: Dec 2006
Posts: 34

Rep: Reputation: 15
Cron restart script wont work!


In crontab i add:
Code:
* 6 * * * /home/restart
In the file /home/restart i add
Code:
#! /bin/sh
shutdown -r now
exit 0
Now i have a script that will restart the server every day at 06:00!

But it the server wont restart!

I know the script is working cause i tried to manualy use ./restart and then it restarted with no problem.

Someone please help me !
 
Old 03-15-2007, 12:27 PM   #2
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
Crontab's PATH is very limited. So give full pathnames. You do not need a script in your home directory, and shouldn't do it like that (I'll leave it to you to work out why not!)
Try this in your crontab:
Code:
* 6 * * *  /sbin/shutdown -r now
Why do you want to restart your server? This is linux, not windows!
 
Old 03-15-2007, 12:38 PM   #3
ThaHabbis
Member
 
Registered: Dec 2006
Posts: 34

Original Poster
Rep: Reputation: 15
HLDS server, the hitbotx gets messy if i dont restart the server
 
Old 03-16-2007, 04:38 AM   #4
timmeke
Senior Member
 
Registered: Nov 2005
Location: Belgium
Distribution: Red Hat, Fedora
Posts: 1,515

Rep: Reputation: 61
You did put this into root's crontab settings, right?
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
shell script using /etc/cron.hourly to execute cron.php file? rioguia Programming 3 06-11-2008 08:09 AM
Why do I have to restart cron each boot? ericcarlson Linux - Software 4 02-14-2007 05:20 AM
script wont work? SBN Programming 8 11-21-2006 08:54 PM
script runs fine from a command line, but doesn't work from cron? kleptophobiac Linux - Software 5 05-03-2004 04:14 PM
cron job to restart process if dead gborrageiro Linux - General 3 09-25-2002 11:55 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

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