Created
May 13, 2022 15:45
-
-
Save nutrino/579bf0fb992039d66102a5ef78282cc6 to your computer and use it in GitHub Desktop.
macOS prevent from accidental unmounting
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 | |
| # https://stackoverflow.com/a/23716566 | |
| screen -D -RR test1 -X quit || true | |
| screen -dmS test1 | |
| screen -r test1 -p 0 -X stuff $"cd /Volumes/SDUltra ^M" |
Author
Author
https://tech.bejond.org/2020/05/05/How-to-make-mac-run-shell-on-startup/
/Library/LaunchAgents/prevent_unmount_service.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>EnvironmentVariables</key>
<dict>
<key>PATH</key>
<string>/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:</string>
</dict>
<key>Label</key>
<string>prevent_unmount_service</string>
<key>ProgramArguments</key>
<array>
<string>/Users/hcshin/prevent_unmount.sh</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<false/>
<key>LaunchOnlyOnce</key>
<true/>
<key>StandardErrorPath</key>
<string>/tmp/startup.prevent_unmount_service.stderr</string>
<key>UserName</key>
<string>hcshin</string>
<key>GroupName</key>
<string>admin</string>
<key>InitGroups</key>
<true/>
</dict>
</plist>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://stackoverflow.com/a/23716566
Where the return character, ^M, you need to enter using vim as
CTRL-V ENTER ESCAPE