Run as Service on MacOSX 10.4 using Launchd

Discuss Mac, Windows, Linux, Unix platform specific issues

Run as Service on MacOSX 10.4 using Launchd

Postby Tech Support » Mon Oct 08, 2007 9:28 am

You can setup the Automize/AbleFtp/JaSFtp Engine to run as a Service on MacOSX 10.4 and later, using Launchd which is installed with MacOSX 10.4 (and later)

Steps to Create the Service:
1) Create a HitekService.plist file using TextEdit. (Sample plist file is shown below)
2) Place the file in '/Library/LaunchDaemons' folder. You should have administrative previliges on the machine and may have to authenticate to place the .plist file here.

IMPORTANT: DO NOT place the .plist file in '~/Library/LaunchAgents' , which is in your home directory.

Starting and Stopping the Service manually:
1) To start the service manually, use the launchctl command from a terminal:
sudo launchctl load /Library/LaunchDaemons/HitekService.plist
2) To stop the service, use :
sudo launchctl unload HitekService
3) To see the list of running services, use:
sudo launchctl list
(In the list, you will see HitekService if it is running)


Steps to test the service:
1) Create a Simple echo task (tasks menu / Misc menu)
2) Schedule it to run every 1 minute and test that it is running every mintue.
3) Restart your system
4) Wait for 3-5 minutes
5) Log on
6) Start up Automize/AbleFTP/JaSFTP user interface. Check from Activity log that echo task has been running for the past 3-5 minutes after startup.
7) Log off for 2-5 minutes
8) Log back on and verify that the echo task has been running during log off.

NOTES:
1) The service is started with the 'root' account.
2) In the activity log, you will get a warning that engine username and user interface username are not the same.
3) If you stop the engine from user interface, the launchd service will start it up again! You have to stop the service using the launchctl command (see above)


Sample HitekService.plist file follows in next post.
Last edited by Tech Support on Thu Oct 11, 2007 1:20 pm, edited 3 times in total.
Tech Support
Site Admin
 
Posts: 1276
Joined: Thu May 25, 2006 11:12 am

Postby Tech Support » Mon Oct 08, 2007 10:00 am

HitekService.plist file listing is below.

1) Make sure to create this file using TextEdit in MacOSX.

2) replace: /Users/john_doe/Desktop/Automize7 with the correct full path to your Automize7 or AbleFTP7 or JaSFTP7 folder.

3) Also, shut down engine, open user interface, start engine, look into activity log and confirm that the java path is: /System/Library/Frameworks/JavaVM.framework/Versions/1.4.2/Home/bin/java
You may have to edit as needed.

4) If you copy and paste this listing into TextEdit, make sure to delete all the whitespace between lines and then hit enter again. i.e. get the correct EOL characters

HitekService.plist file:
-----DO NOT INCLUDE THIS DOTTED LINE------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>HitekService</string>
<key>OnDemand</key>
<false/>
<key>Program</key>
<string>/System/Library/Frameworks/JavaVM.framework/Versions/1.4.2/Home/bin/java</string>
<key>ProgramArguments</key>
<array>
<string>-Xrs</string>
<string>-Dcom.apple.backgroundOnly=true</string>
<string>-cp</string>
<string>.:help:jh.jar:mail.jar:activation.jar:net.jar:jakoro.jar:maverick-all.jar:bsh.jar:hitek7.jar</string>
<string>com.hitek.engine.Engine</string>
</array>
<key>WorkingDirectory</key>
<string>/Users/john_doe/Desktop/Automize7</string>
</dict>
</plist>
Tech Support
Site Admin
 
Posts: 1276
Joined: Thu May 25, 2006 11:12 am


Return to Platform specific issues

Who is online

Users browsing this forum: No registered users and 1 guest

cron