BASH function: Relaunch launchitem
I needed a quick way of stopping and starting a launch item. Rather than the usual process of launchctl unload /item; launchctl load /item. So I put a function in my .bash_rc:
function relaunch()
{
launchitem="${1}"
echo "Unloading ${launchitem}..."
sudo launchctl unload "${launchitem}"
sleep 5
echo "Loading ${launchitem}..."
sudo launchctl load "${launchitem}"
}
Now I can do:
relaunch /Library/LaunchDaemons/theitem.plist
and it will stop the item, wait 5, then load the item.
→