🐍 Python CronJob
Configuration (Optional)
To automatically run the backup script in the background using cron, every 24 hours follow these steps:
- Open the crontab for editing:
crontab -e
- Select an editor if you dont have one configured:
Select an editor. To change later, run 'select-editor'.
1. /bin/nano <---- easiest
2. /usr/bin/vim.basic
3. /usr/bin/vim.tiny
4. /bin/ed
Choose 1-4 [1]: 1
- Add the following line to schedule the
main.py
script to run at midnight every day:
0 0 23 * * /root/lazywarden/venv/bin/python3 /root/lazywarden/app/main.py >> /var/log/lazywarden-cron.log 2>&1
- Save & Close and reload the file. Verify that the cron job is set up correctly:
service cron reload
crontab -l