On the first Tuesday of each month @ 8:00 p.m. ET., we host a live broadcast & chat. New episodes post weekly.

New! A way to support the show.


How to schedule launchd to restart SMB Service in Mavericks Server

Dave Provine of Premier Mac was kind enough to write in with a great tip, following our discussion of SMB issues with Mavericks Server in Episode 60:

No need to restart that mini; you can just restart the SMB daemon, and since SMB is stateless, it normally won’t affect connected users.

To restart the smbd daemon in OS X Server 10.7 10.8 10.9 add this plist to launchd

<?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.psimac.restartsmb</string>
<key>ProgramArguments</key>
<array>
<string>/bin/bash</string>
<string>-c</string>
<string>sleep 60;touch "/Library/Preferences/SystemConfiguration/com.apple.smb.server.plist"</string>
</array>
<key>RunAtLoad</key>
<false/>
<key>StartCalendarInterval</key>
<dict>
<key>Hour</key>
<integer>2</integer>
<key>Minute</key>
<integer>0</integer>
</dict>
</dict>
</plist>

Dave continues:

All you have to do is actually 'touch' the /Library/Preferences/SystemConfiguration/com.apple.smb.server.plist file and that's enough to restart it.

Thanks so much, Dave!