I have a python script in the directory /home/user/models/scripts
When I create the cronjob
18 11 22 02 1 /usr/bin/python3 /home/user/models/scripts/test.py >> ~/models/scripts/cron.log 2>&1
It does not execute. How would i go about solving this?
Python Script
# set up logging
LOG_FILENAME = "/home/user/models/scripts/log_file.log"
logging.basicConfig(filename=LOG_FILENAME, filemode='w', format='%(asctime)s - %(message)s', level=logging.INFO, datefmt='%d-%b-%y %H:%M:%S')
# Connect to the database
def database_config(user, password, database, port, host="localhost"):
conn = psycopg2.connect(user=user, password=password, host=host, port=port, database=database)
return conn
...