Using Crontab to Cut Postgresql Connection
So here i have a problem between my odoo server and postgresql, as i described in my other post about error of odoo loading takes too long time to validate a document. And then i decide to cut and reconnect the session between them automatically everyday using crontab. Crontab is likely a scheduler program in windows which is run a script, command, or an app for particular time based on when you want it to run. It's as simply as that.
So here is how i use crontab :
So here is how i use crontab :
- Login to your server as root;
- In this tutorial i would like to create a script that disconnect and reconnect postgresql so what i need is create a file script named stop.sh and start.sh;
- I create stop.sh by typing nano stop.sh and then type in the command to stop postgres, which is systemctl stop postgresql@11-main. Save it and exit;
- Later on, i make that file executable by running chmod +x stop.sh;
- I repeat the number 4 and 5 step to create start.sh (you can skip this);
- Type command crontab -e;
- Make a setting which you would like to run the previous script you create as following these image :
crontab hour
Here is a basic instruction of crontab, thanks to tecadmin.net for providing the imagecrontab format - Source : tecadmin.net