LFS:FASprint-launchd

From UBC Wiki
Jump to navigation Jump to search

PC Client startup using launchd

Launchd example plist from PaperCut

Slightly modified version, checks for network availability before starting the client. Save the code below into a file named com.papercut.client.plist in /Library/LaunchAgents.

 <?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>KeepAlive</key>
    	   <true/>
       	   <key>Label</key>
       	   <string>com.papercut.pcclient</string>
 
       	   <key>ProgramArguments</key>
		<array>
   		    <string>/usr/bin/open</string>
   		    <string>-W</string>
                    <string>/Applications/PCClient.app</string>
               </array>
       </dict>
 </plist>

Ensure that the file ownership and permissions are correct.

   cd /Library/LaunchAgents/
   sudo chown root:wheel com.papercut.client.plist
   sudo chmod 644 com.papercut.client.plist

Starting the new launch agent for the first time.

   launchctl load /Library/LaunchAgents/com.papercut.client.plist

The agent will start automatically each time you restart your computer.