OS-的Ubuntu 14.04來源:找不到錯誤在Ubuntu上運行shell腳本,而14.04
這是我想用cron作業來安排我的shell腳本。
parser.sh
#!/bin/bash
source .profile
workon venv
cd /home/ashish/deployments/myproject
export DJANGO_SETTINGS_MODULE=myproject.settings_production
python /home/ashish/deployments/myproject/myproject/manage.py parse_data
的Cron求職
*/15 * * * * . /home/ashish/parser.sh
每當這個cron作業運行我收到錯誤郵件:
/bin/sh: 6: /home/ashish/parser.sh: source: not found
/bin/sh: 7: /home/ashish/parser.sh: workon: not found
Traceback (most recent call last):
File "/home/ashish/deployments/myproject/myproject/manage.py", line 8, in <module>
from django.core.management import execute_from_command_line
ImportError: No module named django.core.management
當我運行從終端這個腳本 -
. parser.sh #this gives no error
sh parser.sh #this gives errors
/bin/sh: 6: /home/ashish/parser.sh: source: not found
/bin/sh: 7: /home/ashish/parser.sh: workon: not found
這個腳本中可能的錯誤是什麼?
交叉點:http://askubuntu.com/questions/617665/error-while-cron-scheduling-a-sh-script – Cyrus
對不起,我不知道交叉發佈不允許。我應該刪除一個嗎? –