• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1312
  • Last Modified:

Scheduled Restart in OSX

OK - simple enough I hope, although I'm struggling....

We have a bug in the server software on one of our UNIX servers. This isn't important as we have a simple workaround until they fix it. All we have to do is remember to restart our OSX G5 clients every 24 hours. BUT since not doing this can result in significant data loss I want a foolproof solution that restarts them automatically. I thought about putting a Cron command in, but it doesn't seem to handle the restart command. There must be a simple program or utility or something that will do this...

I found one utility called Kudown - but it only works with 10.1 and 10.2 - I'm on 10.3.5
0
Dave_Watkin
Asked:
Dave_Watkin
  • 5
  • 3
1 Solution
 
brettmjohnsonCommented:
Have you tried running the shutdown command from /etc/crontab?

0      1      *      *      *      root      shutdown -r +15  "System will reboot at 1:15 - save your work NOW!"

0
 
Dave_WatkinAuthor Commented:
Maybe I did it incorrectly, but once I restarted it didn't want to do it again.

Can you run me through the whole thing?
0
 
Dave_WatkinAuthor Commented:
I'll make it a 150 pointer!
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
idarmadiCommented:
To make it automatically run daily,

create a text file in /etc/cron.daily with the command from brett, for example called dailyrestart

#! /bin/bash
shutdown -r +15  "System will reboot at 1:15 - save your work NOW!"

and make sure that this line is in your /etc/crontab

02 4 * * * root run-parts /etc/cron.daily

It should run the command dailyrestart every day now.

Good luck.




0
 
Dave_WatkinAuthor Commented:
Couple of things to clarify please:-

I have the file crontab and I have a file called daily but I don't have cron.daily.

1. Do I create one called cron.daily
2. Is the command for the text file crontab Bretts ie 0 1 * * * (I see this as 1am daily) or 02 4 * * * (is this 4:02 daily)

Also, since you have both been helpful, how do I split points!
0
 
idarmadiCommented:
Dave,

I think I have to made a correction.  Brett's command is perfect. It should run @ 1am every day.

My way (cron.daily) is a 'cron management', so you don't have 100 cron that you run daily in crontab, but all those task will be in cron.daily.

1. the 'daily' is that a directory or a file?  As far as I'm concern, my cron.daily is a directory containing all the task I wanted to do on daily basis.  If yours is call 'daily', then put the 'dailyrestart' inside it.  It doesn't matter what name does it use, just don't forget to change the correspondent directory in crontab.

2. Yes, sorry the timing is up to you. :)  It should be 0 1 * * * if you want to run it @ 1am

Again, Brett's way should work perfectly.  Check your cron log for any error of why it didn't do it after you restart.
0
 
Dave_WatkinAuthor Commented:
Actually the "daily" is a file.

I'll just create a directory called cron.daily and see what happens!

Thanks
0
 
idarmadiCommented:
Another addition :

1. I found it in my unsorted download folder : http://h5197.serverkompetenz.net/cronnix/  It's suppose to be a gui front end for cron.

2. Points.  Give it to Brett.  His suggestion is correct.

0
 
Dave_WatkinAuthor Commented:
Thanks to both of you for your help. Brett, you get the points

 - idarmadi - generous to excess!
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 5
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now