I am working on a small home automation project using raspberry pi (OS -Raspbian).
I want to know how to add more than one crontab file using python-crontab module without replacing the previous entries in crontab -e
?
I want to programatically (without manually going to crontab -e
and adding the files there) schedule two python scripts - first script executes after every 5 minute and another executes after every 2 min.
I was successfully able to schedule first script using python-crontab module
but when I scheduled second script, it replaced the first one in crontab -e
.
So how to schedule the new crontab file without replacing the previous one ?
If there is another way of crontab scheduling please do suggest with an example code :)
Note:- I want to schedule python scripts in crontab using python scripting only not manually adding the files at crontab -e
.
crontab -e
is not a file, its a command. The behaviour you describe reflects that when the default editor is 'vi' (or a derivative) however many Linux distributions now default to nano as the default editor. Further the OP asked how to make changes "programatically" while you have have described an interactive approach. – symcbean Jun 23 '23 at 12:04