Skip to content
Advertisement

@reboot cronjob not executing

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

JavaScript

I want to execute this script at startup via CRON. So I edit the crontab listing by using

JavaScript

My entire crontab looks like :

JavaScript

This is the location of the file, and the file has permissions to execute. I can run the file no problem as a script from the commandline. Yet when I restart the machine, no file is generated. I am trying to understand why, and played around with the crontab entry.

JavaScript

This didn’t work either.

Edit:

JavaScript

gives me

JavaScript

I am unsure how to check if crond is running, or if the user in question is mounted before/after CRON. I’ll try with:

JavaScript

but that hasn’t worked either.

Running:

JavaScript

returns 957

Advertisement

Answer

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:

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement