[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [hobbit] Mac osx startup script?



Rob McBroom wrote:
> On 2009-May-19, at 4:04 PM, William Ottley wrote:
>
>   
>> I have the xymon client running on a mac osx, and I'm now looking to  
>> find a
>> way for the client to run at startup.
>>     
>
> You'll probably want to use launchd to run it. See the man pages for  
> `launchd` and `launchd.plist`. There's a nice tool called [Lingon][1]  
> that will help you create the property list.
>   

Here are some files I've been playing with to get hobbit client
launching under OSX 10.5.

/Library/LaunchDaemons/com.xymon.client.plist
/usr/lib/hobbit/client/launchclient.sh

I put hobbitclient into /etc/defaults rather than /etc/default (which
doesn't exist on OSX).

Then you need to load the launchd plist:
$ sudo -s
# launchctl load /Library/LaunchDaemons/com.xymon.client.plist
# launchctl start com.xymon.client

reboot to be sure to be sure it works on startup.

Still need to get back to completing an OSX package of the client. Maybe
next week...

David.

-- 
David Baldwin - IT Unit
Australian Sports Commission          www.ausport.gov.au
Tel 02 62147830 Fax 02 62141830       PO Box 176 Belconnen ACT 2616
david.baldwin (at) ausport.gov.au          Leverrier Street Bruce ACT 2617


-------------------------------------------------------------------------------------
Keep up to date with what's happening in Australian sport visit http://www.ausport.gov.au

This message is intended for the addressee named and may contain confidential and privileged information. If you are not the intended recipient please note that any form of distribution, copying or use of this communication or the information in it is strictly prohibited and may be unlawful. If you receive this message in error, please delete it and notify the sender.
-------------------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd";>
<plist version="1.0">
<dict>
	<key>Label</key>
	<string>com.xymon.client</string>
	<key>OnDemand</key>
	<false/>
	<key>Program</key>
	<string>/usr/lib/hobbit/client/launchclient.sh</string>
	<key>StandardErrorPath</key>
	<string>/usr/lib/hobbit/client/logs/client.log</string>
	<key>UserName</key>
	<string>xymon</string>
	<key>WorkingDirectory</key>
	<string>/usr/lib/hobbit/client/ext</string>
</dict>
</plist>
#!/bin/sh
#----------------------------------------------------------------------------#
# Hobbit client bootup script.                                               #
#                                                                            #
# This invokes hobbitlaunch, which in turn runs the Hobbit client and any    #
# extensions configured.                                                     #
#                                                                            #
# Copyright (C) 2005-2006 Henrik Storner <henrik (at) hswn.dk>                    #
# "status" section (C) Scott Smith 2006                                      #
#                                                                            #
# This program is released under the GNU General Public License (GPL),       #
# version 2. See the file "COPYING" for details.                             #
#                                                                            #
#----------------------------------------------------------------------------#
#
# $Id: launchclient.sh,v 1.13 2006-07-14 21:25:19 henrik Exp $

# Include hobbit defaults if available
if [ -f /etc/defaults/hobbitclient ] ; then
	. /etc/defaults/hobbitclient
fi

# Default settings for this client
MACHINEDOTS="`uname -n`"			# This systems hostname
BBOSTYPE="`uname -s | tr '[A-Z]' '[a-z]'`"	# This systems operating system in lowercase
BBOSSCRIPT="hobbitclient-$BBOSTYPE.sh"

OLDDIR="`pwd`"
cd "`dirname $0`"
HOBBITCLIENTHOME="`pwd`"
cd "$OLDDIR"

MACHINE="`echo $MACHINEDOTS | sed -e 's/\./,/g'`"

export MACHINE MACHINEDOTS BBOSTYPE BBOSSCRIPT HOBBITCLIENTHOME CONFIGCLASS

#exec $HOBBITCLIENTHOME/bin/hobbitlaunch `eval echo $ (at) `
exec $HOBBITCLIENTHOME/bin/hobbitlaunch --config=$HOBBITCLIENTHOME/etc/clientlaunch.cfg --log=$HOBBITCLIENTHOME/logs/clientlaunch.log --pidfile=$HOBBITCLIENTHOME/logs/clientlaunch.$MACHINEDOTS.pid --no-daemon