python - @reboot cronjob not executing -
i have python script writes text , saves file
#! /usr/bin/python3 def main(): filename = '/home/user/testhello.txt' openfile = open(filename,"w") print("hello cron", file = openfile) if __name__ == "__main__": main();
i want execute script @ startup via cron. edit crontab listing using
>crontab -e
my entire crontab looks :
shell = /bin/bash path = /sbin:/bin:/usr/sbin:/usr/bin mailto = root home = / # run-parts 1 * * * * /home/user/tester.py @reboot /home/user/tester.py
this location of file, , file has permissions execute. can run file no problem script commandline. yet when restart machine, no file generated. trying understand why, , played around crontab entry.
@reboot /usr/bin/python3 /home/user/tester.py
this didn't work either.
edit:
ps aux | grep crond
gives me
user 2259 0.0 0.0. 9436 948 pts/0 s+ 23:39 0:00 grep --color=auto crond
i unsure how check if crond running, or if user in question mounted before/after cron. i'll try with:
sudo crontab -e
but hasn't worked either.
running:
pgrep cron
returns 957
mark roberts pointed out few things i'd done wrong.
namely, spaces here
mail = root home = /
get rid of spaces..
next, having cron configuration fixed email every minute.. instead of had :
*/1 * * * * /home/user/tester.py
seems me lubuntu doesn't support @reboot cron syntax.
Comments
Post a Comment