Bope
Posts: 71
Joined: Sat Jul 06, 2019 2:57 am

cron vs datetime script

Sun Sep 15, 2019 3:26 pm

Once I get my leak sensor all hooked up it will be running headless so I want it to send me a message once a month just to let me know it is still running. My understanding is if I use a cron job I could set it up to run a separate python script that will send me out a text message. Does this affect the constantly running python script for my leak tester?

Alternatively I could use datetime in my python script to parse out the 1st of the month and have it send me a text. Is there any reason to do one or the other?

trejan
Posts: 2134
Joined: Tue Jul 02, 2019 2:28 pm

Re: cron vs datetime script

Sun Sep 15, 2019 4:08 pm

If the message is to show it is running still then put it into your Python script. A cronjob will only show that the Pi is running and cron is working. The Python script could have died months ago but the cronjob wouldn't know anything about it.

Bope
Posts: 71
Joined: Sat Jul 06, 2019 2:57 am

Re: cron vs datetime script

Sun Sep 15, 2019 4:58 pm

I was just having the same idea. I added it to my script.

Return to “Beginners”