Файл WSL cron.d cronjobs не работает [dублировать]

Этот вопрос уже имеет ответ здесь: cron error: bad username 3 ответа

В WSL Ubuntu 16.04 запустил nano /etc/cron.d/cronjobs и там я написал * * * * * touch /var/www/html/myFile (это единственные данные в этом файле ). Я сохранил файл, подождал минуту, но файл не был создан в /var/www/html/.

Я удостоверился, что служба cron работает (service cron start), получила «ОК» и подождала еще минуту.

Тем не менее, touch не действует --- файл по имени myFile не создан в /var/www/html.

Что я пропустил? [ ! d9]

-1
задан 18 January 2018 в 05:20

3 ответа

В отличие от пользовательских crontabs, задания в /etc/cron.d (например, в файле crontab всей системы /etc/crontab) требуется дополнительное поле для указания пользователя, например

* * * * * root touch /var/www/html/myFile

From man 8 cron:

   Additionally, in Debian, cron reads the files in the /etc/cron.d direc‐
   tory.  cron treats the files in /etc/cron.d as in the same way  as  the
   /etc/crontab  file  (they  follow the special format of that file, i.e.
   they  include  the  user  field).  
2
ответ дан 22 May 2018 в 15:28
  • 1
    Я добавил root между синхронизацией и командой и сохранил файл, но, к сожалению, никаких изменений не наблюдается. Файл не создается с помощью * * * * * root touch /var/www/html/myFile. – Arcticooling 18 January 2018 в 05:48
  • 2
    @Arlicooling WSL предоставляет файл / var / log / syslog? если да, то видите ли вы, что cron пытается запустить там задание (например, grep CRON /var/log/syslog)? – steeldriver 18 January 2018 в 05:57

В отличие от пользовательских crontabs, задания в /etc/cron.d (например, в файле crontab всей системы /etc/crontab) требуется дополнительное поле для указания пользователя, например

* * * * * root touch /var/www/html/myFile

From man 8 cron:

Additionally, in Debian, cron reads the files in the /etc/cron.d direc‐ tory. cron treats the files in /etc/cron.d as in the same way as the /etc/crontab file (they follow the special format of that file, i.e. they include the user field).
2
ответ дан 17 July 2018 в 22:45

В отличие от пользовательских crontabs, задания в /etc/cron.d (например, в файле crontab всей системы /etc/crontab) требуется дополнительное поле для указания пользователя, например

* * * * * root touch /var/www/html/myFile

From man 8 cron:

Additionally, in Debian, cron reads the files in the /etc/cron.d direc‐ tory. cron treats the files in /etc/cron.d as in the same way as the /etc/crontab file (they follow the special format of that file, i.e. they include the user field).
2
ответ дан 24 July 2018 в 13:22

Другие вопросы по тегам:

Похожие вопросы: