Created
November 29, 2017 19:55
-
-
Save MuntashirAkon/fd6d2174f52f85635bb2125a3cfa765b to your computer and use it in GitHub Desktop.
DisableSpindump
This file contains 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 | |
# | |
# disablespindump | |
# Script to disable spindump | |
# | |
# (c) Muntashir Al-Islam | |
# License: MIT License | |
# | |
# | |
# Alert if not a root user | |
# | |
if ! [ `id -u` -eq 0 ]; then | |
echo "The script must be run as root!" | |
exit 1 | |
fi | |
spindump_file="/System/Library/LaunchDaemons/com.apple.spindump.plist" | |
# | |
# Main | |
# | |
if [ -e $spindump_file ]; then | |
status=`sudo launchctl list | grep com.apple.spindump` | |
status=$? | |
if [ $# -eq 1 ] && [ $1 = "false" ]; then | |
if [ $status -eq 0 ]; then | |
echo "spindump has already enabled." | |
exit 1 | |
else | |
`sudo launchctl load -w $spindump_file` | |
if [ $? -eq 0 ]; then | |
echo "spindump is now enabled." | |
exit 0 | |
else | |
echo "Cannot enable spindump, try again." | |
exit 1 | |
fi | |
fi | |
else | |
if [ $status -eq 1 ]; then | |
echo "spindump has already disabled. Use 'false' argument to enable it." | |
exit 1 | |
else | |
`sudo launchctl unload -w $spindump_file` | |
if [ $? -eq 0 ]; then | |
echo "spindump is now disabled." | |
exit 0 | |
else | |
echo "Cannot disable spindump, try again." | |
exit 1 | |
fi | |
fi | |
fi | |
else | |
echo "spindump is already disabled or not available" | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
DisableSpindump
A script to prevent spindump from loading at startup.
Installation
disablespindump
and copy it to/usr/bin
Usage
Always run
disablespindump
usingsudo
. The default behavior is to disablespindump
.To enable
spindump
, runsudo disablespindump false
.License
MIT License