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
LVL 4
Dave_WatkinAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Mac OS X

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.