【发布时间】:2014-12-26 23:47:30
【问题描述】:
我正在尝试使用 cron 运行 shell 脚本文件,但出现权限被拒绝错误。
这是我的 cron 文件。
53 14 30 10 * $HOME/Documents/Python/shellScript.sh
我想在今天的特定时间运行 shellScript 文件。
这是我的 shellScript.sh 文件。
osascript<<EOF
tell application "System Events"
tell process "Terminal" to keystroke "t" using command down
end
tell application "Terminal"
activate
do script with command "python file1.py" in window 1
end tell
EOF
osascript<<EOF
tell application "System Events"
tell process "Terminal" to keystroke "t" using command down
end
tell application "Terminal"
activate
do script with command "./ngrok 5000" in window 1
end tell
EOF
python file2.py
我在邮件中收到了这个。 /bin/sh: /Users/XXX/Documents/Python/shellScript.sh: 权限被拒绝
如果有人可以帮助我,那就太好了。 谢谢
【问题讨论】:
-
发布
ls -l shellScript.sh的输出。请将输出编辑到您的帖子中 -
您必须在执行脚本之前授予执行权限。
chmod u+x shellScript.sh -
@Hackaholic 是的,它奏效了。如果您可以在答案中发布您的答案,那么我愿意接受。