Answer the question
In order to leave comments, you need to log in
Why does the script not work via cron (sh->php)?
This is how the script works fine
crontab -e
*/1 * * * * /usr/bin/php /var/www/site/get_data.php >/dev/null 2>&1
*/3 * * * * /var/www/site/get_data.sh >/dev/null 2>&1
#!/bin/bash
for i in {1..10}
do
/usr/bin/php /var/www/site/get_data.php >/dev/null 2>&1
sleep 10
done
Answer the question
In order to leave comments, you need to log in
Judging by the comment: Why doesn't the script work via cron (sh->php)?
The problem is that you saved the file on Windows.
It's good to read about crlf and lf.
Problem solution:
The script is small, you can rewrite it directly on Linux with your hands (for example, in nano)
Or try using the solution from here:
stackoverflow
awk '{ sub("\r$", ""); print }' get_data.sh > get_data2.sh
mv get_data2.sh get_data.sh
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question