Velvet Star Monitor

Standout celebrity highlights with iconic style.

general

Schedule python script

Writer Matthew Harrington

I'm wanting schedule the execution python script at 08:00 AM, 18:00 PM and 22:00 PM. Checking the Crontab documentation, I think that the command would be

0 8,18,22 * * * /home/test/script.py

Now to create this task, Do I need to use crontab -e and last line add the command above?

1 Answer

Looks correct to me.

Yes, you can open the task list by use of crontab -e. But you need to make sure, permissions are correct. If the script needs root access, you can't run it as user.

Also, just editing the task list alone won't do the trick. You need to make sure, some daemon like cronie is active and running to execute the tasks.

You can check, if cronie is active by use of:

systemctl status cronie

It might ask for permission or you might have to use sudo.

3 possible outcomes. Cronie might be active, inactive or not even installed. Last one should be fairly self-explanatory. You need to install cronie (apt-get install cronie).

systemctl start cronie.service

would start it temporarily. Usually that works fine and needs no settings. You can check the status again.

To make sure it's active after reboot and always, you need to ...

systemctl enable cronie.service

Just to have mentioned it, as a helper: if you are not sure about anything about this, you can always use some dummy script for testing. Just let it for example echo a timestamp into a file and see if it works.

5

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy