Subjectively

dd if=/dev/random | kirk > blog

Subjectively header image 2

launchd script for OS/X for bash daemon

November 19th, 2009 · No Comments · Linux, OS X

This is the promised launchd script to run the service in an earlier post.

The name of this file is /Library/LaunchDaemons/com.{domain_name}.{service_name}.plist

Replace any text in curly braces {} with some appropriate information for your script.

When you are finished creating the file, load it with:

 
launchctl load -w /Library/LaunchDaemons/com.{domain_name}.{service_name}.plist

It should crank right up and start doing its’ thang.

Here’s the content of the .plist file:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?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>Enabled</key>
	<true/>
	<key>GroupName</key>
	<string>staff</string>
	<key>KeepAlive</key>
	<true/>
	<key>Label</key>
	<string>com.{domain_name}.{service_name}</string>
	<key>Program</key>
	<string>/usr/local/bin/{script_name}</string>
	<key>ProgramArguments</key>
	<array>
		<string>{script_name}</string>
		<string>start</string>
		<string>--nofork</string>
	</array>
	<key>QueueDirectories</key>
	<array/>
	<key>RunAtLoad</key>
	<true/>
	<key>ServiceDescription</key>
	<string>Some creative description of your service.</string>
	<key>UserName</key>
	<string>{user_name}</string>
	<key>WatchPaths</key>
	<array/>
</dict>
</plist>

Tags:

No Comments so far ↓

There are no comments yet...Kick things off by filling out the form below.

Leave a Comment

You must log in to post a comment.