我在桌面文件夾中有一個bash腳本script.sh。當我從終端(cd桌面 - > bash script.sh)運行它時,我的服務器啓動了。啓動時運行Bash腳本mac
但我想運行此啓動mac。我看到很多地方對於建立圖書館/ LaunchAgent plist文件中我創建了一個plist文件,但我以前不工作
人有想法什麼我錯了
<?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.example.loginscript</string>
<key>ProgramArguments</key>
<array>
<string>/bin/bash</string>
<string>/Users/salonisajwan/Desktop</string>
<string>bash script.sh</string>
</array>
<key>KeepAlive</key>
<true/>
</dict>
</plist>
最好是通過'launchd'運行它,但你也可以把它放在'/ Library/StartupItems'的子目錄中。見https://developer.apple.com/library/mac/documentation/macosx/conceptual/bpsystemstartup/chapters/StartupItems.html – Barmar
@Barmar我添加一個plist文件,但它沒有奏效,你能告訴我什麼是錯誤的它... – morroko
這與iphone或applescript有什麼關係?你應該編輯你的標籤。 –