Showing posts with label launchd. Show all posts
Showing posts with label launchd. Show all posts

Saturday, 19 May 2012

Prevent the FitBit daemon from filling your system logs

On the Mac the FitBit daemon logs to the system.log but it can be a bit verbose.

The following change to the FitBit launch daemon should send the output to its own file:
--- com.fitbit.fitbitd.plist.orig 2012-05-19 09:24:54.000000000 +0100
+++ com.fitbit.fitbitd.plist      2012-05-19 09:06:51.000000000 +0100
@@ -44,5 +44,9 @@
     <false/>
     <key>Disabled</key>
     <false/>
+    <key>StandardErrorPath</key>
+    <string>/var/log/fitbitd.log</string>
+    <key>StandardOutPath</key>
+    <string>/var/log/fitbitd.log</string>
   </dict>
 </plist>
Don't forget to create the file ahead of time and give it the correct permissions.
$ sudo touch /var/log/fitbitd.log && sudo chown nobody: /var/log/fitbitd.log
Restart fitbitd:
$ cd /Library/LauchDaemons
$ sudo launchctl unload com.fitbit.fitbitd.plist
$ sudo launchctl load com.fitbit.fitbitd.plist

Saturday, 5 December 2009

Enabling SNMP in Mac OS X 10.6 (Snow Leopard)

Under Snow Leopard there is a slight change to the way services are enabled.
-w       Overrides the Disabled key and sets it to false. In previous versions, this
         option would modify the configuration file. Now the state of the Disabled key
         is stored elsewhere on-disk.

So, to enable the SNMP daemon correctly:
$ sudo launchctl load -w /System/Library/LaunchDaemons/org.net-snmp.snmpd.plist

Thursday, 26 February 2009

Automatic mounting of SSH filesystems in OS X

Getting your MacFUSE SSH filesystem to mount automatically on login isn't Voodoo, but it is Magick.

Here's how it's done using launchd:

Create a Properties List file under, ~/Library/LaunchAgents:

eg: ~/Library/LaunchAgents/com.example.sshfs.plist
<?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>com.example.sshfs</string>
    <key>ProgramArguments</key>
    <array>
      <string>/opt/local/bin/sshfs</string>
      <string>user@example.com:path/to/share</string>
      <string>/path/to/mountpoint</string>
      <string>-f</string>
      <string>-o</string>
      <string>auto_cache,reconnect,volname=friendly_name</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
  </dict>
</plist>

We can now load this into launchd by running,
$ cd ~/Library/LaunchAgents 
$ launchctl load com.example.sshfs.plist

Your SSH filesystem should now be mounted.
$ mount
    .
    .
    .
user@example.com:path/to/share on /path/to/mountpoint (fusefs, nodev, nosuid, synchronous, mounted by user)