bailoo / itrack

Location Tracking for Everyone
3 stars 2 forks source link

Permission problem in ubuntu #16

Closed rizcompeer closed 9 years ago

rizcompeer commented 9 years ago

Purpose is to run this sh file in backend every hour. 0 * * * * sh /mnt/itrack/ReportPhpBackend/hourly_report/mumbai/send_hourly_mail_halt.sh

Root path : /mnt/itrack/ReportPhpBackend/hourly_report/mumbai

Content of send_hourly_mail_halt.sh

!/usr/bin/php

cd cd /mnt/itrack/ReportPhpBackend/hourly_report/mumbai - php mail_hourly_halt_report.php

sent_file is a directory in Root path It is a softlink pointing to the directory outside of the git repository as-

sent_file -> /mnt/report_temp/hourly_report/mumbai/sent_file

Problem is : cron is unable to run this sh file We checked using some other syntax too, but did not work - 59 /1 * * * sh /mnt/itrack/ReportPhpBackend/hourly_report/mumbai/send_hourly_mail_halt.sh /59 * * * * sh /mnt/itrack/ReportPhpBackend/hourly_report/mumbai/send_hourly_mail_halt.sh

bailoo commented 9 years ago

It is working now. See via crontab -e. There is no need to specify sh in crontab because sh is the default shell. However, in the executable we have used #!/bin/bash because bash is the shell we want to use. Error was to define php as the shebang. Whatever you want to execute via crontab must be a shell executable script. Now output of your scripts is being logged in /home/ubuntu/ml.log you can inspect this for debugging and then delete this periodically, before it grows too big.