AFP548 Changing the world one server at a time.

How to create launchd daemon to reboot server?

Home › Forums › OS X Server and Client Discussion › Questions and Answers › How to create launchd daemon to reboot server?

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #375661
    ksry
    Participant

    Hello!

    Because of the actual AFP CPU-Load problems with Mac OS X Server 10.5.6, I’ve decided to write a launchd daemon to reboot our Xserve once per week. In this case on saturday at 3:15 am. This is how my Property List file looks like:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTD$
    <plist version="1.0">
    <dict>
            <key>Label</key>
            <string>com.example.reboot</string>
            <key>ProgramArguments</key>
            <array>
                    <string>/sbin/reboot</string>
            </array>
            <key>LowPriorityIO</key>
            <true/>
            <key>Nice</key>
            <integer>1</integer>
            <key>StartCalendarInterval</key>
            <dict>
                    <key>Hour</key>
                    <integer>3</integer>
                    <key>Minute</key>
                    <integer>15</integer>
                    <key>Weekday</key>
                    <integer>6</integer>
            </dict>
    </dict>
    </plist>

    I’ve created the file directly in Terminal.app with pico and saved as ‘com.example.reboot.plist’ (without quotes) in /Library/LaunchDaemons. Than loaded the daemon with ‘sudo launchctl load /Library/LaunchDaemons/com.example.reboot.plist’. Last but not least I’ve checked the result with ‘launchctl list’. The daemon successfuly loaded.

    Unfortunately for some reason the reboot won’t execute. I guess there is a mistake in the syntax of my plist file. I have no experience with launchd daemons and therefore can’t find the bug in my xml file. It would be much appreciated if somebody could put me in the right direction.

    With best regards,

    ksry

Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.