设置PostgreSQL开机自启动
PostgreSQL的开机自启动脚本位于PostgreSQL源码目录的contrib/start-scripts路径下
cd /opt/soft_bak/postgresql-10.1/contrib/start-scripts/

linux文件即为linux系统上的启动脚本
1)修改linux文件属性,添加X属性
#chmod u+x linux
#chmod o+x linux

SRE实战 互联网时代守护先锋,助力企业售后服务体系运筹帷幄!一键直达领取阿里云限量特价优惠。

2) 复制linux文件到/etc/init.d目录下,更名为postgresql
#cp linux /etc/init.d/postgresql

3)修改/etc/init.d/postgresql文件的三个变量

 

 

/opt/pg_root
/opt/pgsql101


4) 执行service postgresql start,就可以启动PostgreSQL服务
#service postgresql start

5)设置postgresql服务开机自启动
#chkconfig --add postgresql

执行上面的命令,就可以实现postgresql服务的开机自启动。

扫码关注我们
微信号:SRE实战
拒绝背锅 运筹帷幄