Imported from the Apple Support Forums via the Wayback Machine 🔗
Crontab reboot command not working
Greetings
I am new at this so excuse any ignorant mistakes I might be making.
I have a server (MM X.4.9) that I would like to restart every day in order to make sure no programmes are hanging etc. If a program is hanging is should force quit it. Using terminal I have entered the following command:
sudo nano /etc/crontab
Entered password
Than I entered using tab between each sequence:
15 13 1 1 * root reboot
This was a test run and it did not reboot.
Entering
cat /etc/crontab
I got:
# The periodic and atrun jobs have moved to launchd jobs
Imported from the Apple Support Forums via the Wayback Machine 🔗
Hi ChangeAgent,
Use the absolute path, /sbin/reboot.
--
Gary
~~~~
No matter what other nations may say about the United States,
immigration is still the sincerest form of flattery.
0
ChangeAgent·
Imported from the Apple Support Forums via the Wayback Machine 🔗
Just did that and no cigar.
Last login: Sun Jun 24 17:20:52 on ttyp1
Welcome to Darwin!
You have mail.
:~ e$ sudo nano /etc/crontab
:~ e$ sudo nano /etc/crontab
:~ e$ cat /etc/crontab
# The periodic and atrun jobs have moved to launchd jobs
# See /System/Library/LaunchDaemons
#
# minute hour mday month wday who command
25 17 1 1 1 * root /sbin/reboot
:~ e$
any other ideas?
0
Charles Minow·
Imported from the Apple Support Forums via the Wayback Machine 🔗
any other ideas?
Don't edit /etc/crontab directly. Use crontab -e instead (that'll use vi as the editor, by default).
charlie
0
ChangeAgent·
Imported from the Apple Support Forums via the Wayback Machine 🔗
greetings both of you,
Got it to work. Thanks.
Seems to be a rough ride as the server just closes down without quitting anything. is this OK for the programs? or can one ad a line or two to have it first quit all programs?
Thanks
0
Gnarlodious·
Imported from the Apple Support Forums via the Wayback Machine 🔗
It does quit everything so it's not like pulling the plug, but does not report what it's doing. The reboot command is like Applescript's
<pre class=COMMAND>
tell application "System Events"
restart
end tell
</pre>
which bypasses all dialogs.
Take a look at the system log for more details:
tail -100 /private/var/log/system.log
0
ChangeAgent·
Imported from the Apple Support Forums via the Wayback Machine 🔗
Thanks Gnarlodious
I understand, however I had left a Word document open on purpose with unsaved changes and it did not hang on it, it just shut Word down, on opening again (after restart) it showed a saved copy (auto safe) in the same way Word does if you force quit of crash. So it looks like it just pulls the plug. It also happened very fast, one moment the desktop the next moment a blue screen and out went the lights.
So what happened in the case of the Word programme?
Sincerely,
your humble Terminal apprentice.
0
Gnarlodious·
Imported from the Apple Support Forums via the Wayback Machine 🔗
Hehe, there you are experimenting with a "reboot" cron command and you are surprised it quit so fast. You are not going to find a "graceful" solution to shutdown dialogs.
MSWord is a Java app, so it is especially important for the command to work that it doesn't get hung up on outer layers of the system. Especially stupid apps that use Java which is not well integrated. I believe Word has a 5 minute autosave, so you should be able to recover most of your document.
This reboot command should be running around 2AM, when the average webserver has minimum traffic. If you feel the need to reboot during busier times of the day, I'd suggest you look at what's causing your applications to crash.
0
ChangeAgent·
Imported from the Apple Support Forums via the Wayback Machine 🔗
I was just wondering, I tested it on my MBP machine and had this result. My server runs other programs but not word, so no worries there.
So you say it is 100% safe? It will not do any harm to the programs?
0
ChangeAgent·
Imported from the Apple Support Forums via the Wayback Machine 🔗
PS
I'd suggest you look at what's causing your
applications to crash.
I did and I found why the one does get stuck. (it hangs). but I thought a reboot would be good as I sometimes have no change of getting in to it (it is local server not accessible via internet) as I am on the road.