Set up PostgreSQL boot from
PostgreSQL's boot-up script is located under the contrib/start-scripts path of the PostgreSQL source directory
The Linux file is the startup script on the Linux system
1) Modify the Linux file properties and add the X attribute
#chmod A+x Linux
2) Copy the Linux file to the/ETC/INIT.D directory and rename it to PostgreSQL
#cp Linux/etc/init.d/postgresql
3) Modify the two variables of the/etc/init.d/postgresql file
Prefix installation path set to PostgreSQL:/opt/pgsql-9.4.4
Pgdata Data Directory path set to PostgreSQL:/opt/pgsql/data
4) The PostgreSQL service can be started by executing service PostgreSQL start
#service PostgreSQL Start
5) Set up PostgreSQL service to boot from
#chkconfig--add PostgreSQL
Execute the above command to enable the start-up of the PostgreSQL service.
A different way
PostgreSQL database Linux system boot up
chmod A+x/opt/postgresql-8.4.3/contrib/start-scripts/linux
Cp/opt/postgresql-8.4.3/contrib/start-scripts/linux/etc/init.d/postgresql
Chkconfig--add PostgreSQL
Vi/ect/init.d/postgresql
Modify the Start section code
su-$PGUSER-C "$DAEMON-i-d ' $PGDATA ' &" >> $PGLOG 2>&1 Plus-I parameter to support Java program fetch processing
Reboot
Settings for Environment variables
You can add the following to the UNIX user's ~/.bash_profile or ~/.profile file,
[Email protected] postgresql-9.4.0]# Su-postgres
[Email protected] ~]$ VI ~/.bash_profile
... #postgres
Pgdata=/usr/local/pgsql/data
Path=/usr/local/pgsql/bin: $PATH
Export PGDATA PATH
[Email protected] ~]$. . bash_profile
Configuration of the start-up service and environment variables for PostgreSQL under Linux