@reboot cronjob not executing

后端 未结 4 1084
说谎
说谎 2021-01-15 12:30

I have a Python script which simply writes some text and saves it to a file

#! /usr/bin/python3
def main():
     filename = \'/home/user/testHello.txt\'
             


        
4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-15 12:36

    From what I've discovered just now, the @reboot syntax seems to depend on what crontab you're editing. I found that for the system-level /etc/cron.d/ folder, entries there must have a user, just like regular time-based crons.

    Thus this worked for me, on Ubuntu 14.04, to run the specified command as root on startup:

    @reboot root /home/vagrant/log.sh
    

提交回复
热议问题