Joh*_*hir 12 boot script login osx-snow-leopard macos
我想要一个脚本 (bash/zsh/ruby/...) 在启动时在 OS X 中运行。最简单的方法是什么,不要弄乱 xml/plist 文件,最好不需要制作元 AppleScript .
MacOS X 使用 Vixie cron,它具有用于在重启时启动的特殊元标记。有关文件格式,请参阅手册页。
就像是:
@reboot /path/to/script.sh
Run Code Online (Sandbox Code Playgroud)
在您的 crontab 中会起作用。我不确定这是否是比 launchd 更好的解决方案,您可能拥有比 cron 更多的元工具来查看 launchd。
如果您改变意见:
<?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>Label</key>
<string>com.superuser.245713</string>
<key>ProgramArguments</key>
<array>
<string>/path/to/script.sh</string>
</array>
<key>UserName</key>
<string>someuser</string>
</dict>
</plist>
Run Code Online (Sandbox Code Playgroud)
存储为com.superuser.245713.plistin/Library/LaunchAgents/并创建root:wheel所有者/组。
| 归档时间: |
|
| 查看次数: |
20661 次 |
| 最近记录: |