Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Scheduled Restart in OSX

Posted on 2004-10-27
9
Medium Priority
?
1,294 Views
Last Modified: 2010-05-18
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
Comment
Question by:Dave_Watkin
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
9 Comments
 
LVL 23

Accepted Solution

by:
brettmjohnson earned 600 total points
ID: 12423812
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
 
LVL 4

Author Comment

by:Dave_Watkin
ID: 12423890
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
 
LVL 4

Author Comment

by:Dave_Watkin
ID: 12423894
I'll make it a 150 pointer!
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
LVL 5

Expert Comment

by:idarmadi
ID: 12429971
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
 
LVL 4

Author Comment

by:Dave_Watkin
ID: 12431125
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
 
LVL 5

Expert Comment

by:idarmadi
ID: 12431637
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
 
LVL 4

Author Comment

by:Dave_Watkin
ID: 12431657
Actually the "daily" is a file.

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

Thanks
0
 
LVL 5

Expert Comment

by:idarmadi
ID: 12431669
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
 
LVL 4

Author Comment

by:Dave_Watkin
ID: 12432054
Thanks to both of you for your help. Brett, you get the points

 - idarmadi - generous to excess!
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article we have discussed about the OS X EI Capitan and how to fix Wi-Fi issue in OS X El Capitan. We have explained how to delete system level preferences and create a new Wi-Fi location to resolve Wi-Fi issue.
In this article we discuss how to recover the missing Outlook 2011 for Mac data like Emails and Contacts manually.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question