Solved

Scheduled Restart in OSX

Posted on 2004-10-27
1,248 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
Question by:Dave_Watkin
    9 Comments
     
    LVL 23

    Accepted Solution

    by:
    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
    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
    I'll make it a 150 pointer!
    0
     
    LVL 5

    Expert Comment

    by:idarmadi
    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
    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
    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
    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
    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
    Thanks to both of you for your help. Brett, you get the points

     - idarmadi - generous to excess!
    0

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Learn The Basics of Ethical Hacking & Pen Testing

    Computer and network security is one of the fastest growing and most essential industries in technology, meaning companies will pay big bucks for ethical hackers. This is the perfect course to leap into this lucrative career, learning how to use ethical hacking to reveal ...

    Syslogd is a utility that traps and logs messages sent by running processes. It is configured with the syslog.conf file, which consists of lines containing a pair of fields: "the selector field which specifies the types of messages and priorities to…
    Set up iPhone and iPad email signatures to always send in high-quality HTML with this step-by step guide.
    This video Micro Tutorial is the second in a two-part series that shows how to create and use custom scanning profiles in Nuance's PaperPort 14.5 (http://www.experts-exchange.com/articles/17490/). But the ability to create custom scanning profiles a…
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…

    856 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

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now