Created
July 19, 2019 14:32
-
-
Save toonetown/ffb277d23652f3d2e69ae88eb4ca4865 to your computer and use it in GitHub Desktop.
Startup/Shutdown
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
function shutdown() | |
{ | |
# INSERT HERE THE COMMAND YOU WANT EXECUTE AT SHUTDOWN OR SERVICE UNLOAD | |
exit 0 | |
} | |
function startup() | |
{ | |
# INSERT HERE THE COMMAND YOU WANT EXECUTE AT STARTUP OR SERVICE LOAD | |
tail -f /dev/null & | |
wait $! | |
} | |
trap shutdown SIGTERM | |
trap shutdown SIGKILL | |
startup; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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.toonetown.shutdown</string> | |
<key>ProgramArguments</key> | |
<array> | |
<string>/usr/local/sbin/boot-shutdown.sh</string> | |
</array> | |
<key>RunAtLoad</key> | |
<true/> | |
</dict> | |
</plist> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
From https://stackoverflow.com/a/27102949
You can customize and place your
boot-shutdown.sh
script in/usr/local/sbin
- make sure you set the permissions to711
on the file.Place
com.toonetown.shutdown.plist
into/Library/LaunchDaemons
and run: