Postgresql - Automatic database startup
Colleagues hello to all. In today's article, I will tell you how to set up automatic startup of the Postgresql database. As you remember, in the last article, I showed you how to install the Postgresql database from the source files. But if you restart the server or the server crashes, your database will not start after the server starts. Download and install Postgresql 14 on Linux CentOS/RHEL 8/7 TAR The first thing we will start with is to create a script that will be executed after the server is restarted. $. vim /home/postgres/pgsql_autostart.sh After creating the pgsql_autostart.sh file, add the following contents to it: #!/bin/bash #Automatic database start after server reboot export PGHOME=/app/postgresql export LD_LIBRARY_PATH=/app/postgresql/lib export PGDATA=/app/postgresql/pgdatabase/data export PATH=$PGHOME/bin:$PGDATA:$PATH pg_ctl start Next, we assign the necessary rights to this file. $. chmod +x pgsql_autostart.sh Now add this file to crontab. $. crontab -e