PHP dosyasını cron sekmeleri aracılığıyla /var/www/html/rss_feed/mirror.php
yolunda çalıştırmaya çalışıyorum. Bunun için aşağıdaki adımları gerçekleştirdim. PHP betiğini çalıştırmak için Crontab Çizelgesi
sudo crontab -e
Sonra aşağıda görebileceğiniz bir php dosyasını çalıştırmak için her 2 dakikada cron sekmeyi planlamak için eklenen kod satırı olduğu gibi aşağıdaki kodu
# Edit this file to introduce tasks to be run by cron.
#
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
#
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use '*' in these fields (for 'any').#
# Notice that tasks will be started based on the cron's system
# daemon's notion of time and timezones.
#
# Output of the crontab jobs (including errors) is sent through
# email to the user the crontab file belongs to (unless redirected).
#
# For example, you can run a backup of all your user accounts
# avt 5 a.m every week with:
# 0 5 * * 1 tar -zcf /ar/backups/home.tgz /home/
#
# For more information see the manual pages of crontab(5) and cron(8)
*/2 * * * * /usr/bin/php /var/www/html/rss_feed/nbt_times.php
#
# m h dom mon dow command
ekleyerek dosyayı düzenleyen.
*/2 * * * * /usr/bin/php /var/www/html/rss_feed/nbt_times.php
Hatta farklı makalelerden
2 * * * * lynx -dump http://192.168.0.232/rss_feed/mirror.php > /dev/null 2>&1
ve hatta bu
2 * * * * /your/path/to/php /var/www/html/rss_feed/nbt_times.php
ve daha birçok formatları aşağıdaki çalıştı.
PHP betiği çalışmıyor. Kodu başka bir yere koymam gerekiyor mu? Ya da yanlış yoldayım. Sorunun ne olduğunu bulmama yardım edebilir misin?
Hata günlüklerini kontrol edin? –
Hata kaydında bile giriş yok. Mirror.php için aradım. Ama hiçbir şey alamadım –
php dosyasını komut satırından çalıştır - işe yarıyor mu? – Andrew