Creating Automatic Backup on PostgreSQL

in #esteem5 years ago

Last month I was testing a PostgreSQL database server installed in an Ubuntu Server when I have trouble setting up an automatic backup for a postgres database using a cron job.

Crontab or cron job is a utility in a Linux operating system that let you schedule a specific job on the server without user intervention.

It was my first time to use a cron job to automatically backup a database on a PostgreSQL.

On my first attempt the script (on the cron job) did not execute on the time that I set. On the second and third the same happened.

Right at that moment I am wondering why the script is not working. I double checked and triple check the script (the script is correctly configured).

When an idea popped-up in my mind, why not check the system date and time of the Ubuntu Server.

Just as I thought, the time and date of the Ubuntu is incorrectly configured (it is set to +00 UTC).

And that's it. The scrip (cron job) is not working because the time of the Ubuntu Server is not synced with the time that I am using on the script.

When I changed the time and date of the Ubuntu Server the script did execute correctly.

What happened

When I installed Ubuntu Server, I correctly set the time zone on the installation process. But it turns out that it is not working.

I found it out on the two Ubuntu Server 18.04.2 64-bit that I installed, setting-up the time zone on the installation process doesn't work.

You need to manually set your time zone to your local time whenever you install Ubuntu Server 18.04.2.

But it could only be an isolated case (I am setting-up Asia/Manila in the installation).



I am an I.T. professional (Computer Engineer) working in a private company, a blogger, a father and a husband.


357u2dlv22.png

t2igarqmc5.gif

s6g5fdmpr8.png

2b61yhskz8.png

Coin Marketplace

STEEM 0.18
TRX 0.15
JST 0.029
BTC 62020.79
ETH 2420.03
USDT 1.00
SBD 2.64