Crontab - adeemacdowell/adeemacdowell.github.io GitHub Wiki

cd to system root

sudo crontab -e

//add line to cron

* * * * * sh /cron_minute.sh >> out.txt 2>&1

create the .sh

sudo touch cron_minute.sh

sudo chmod +x cron_minute.sh

run this to get your python path

which python3

#/usr/local/bin/python3

//use this in the .sh file below

add these lines to the .sh

#!/bin/sh

/usr/local/bin/python3 /cron_minute.py

sendemail -f [email protected] -t [email protected] -u subject -m "21Testing Your DB" -s smtp.gmail.com:587 -o tls=yes -xu [email protected] -xp ymqpaglsmioujgtc

create the python file

sudo touch cron_minute.py

sudo chmod +x cron_minute.py

//add script code to python file