Linux下设置postgresql数据库开机启动


Linux下设置postgresql数据库开机启动

PostgreSQL的开机自启动脚本位于PostgreSQL源码目录的contrib/start-scripts路径下,linux文件即为linux系统上的启动脚本:

1、将Linux文件复制到 /etc/init.d 目录下,并且将其重名为postgresql

# cp linux /etc/init.d/postgresql

2、进入 /etc/init.d 目录下,修改postgresql文件

 # cd /etc/init.d/   
 # vi postgresql 

将prefix设置为postgresql的安装路径:/usr/local/postgresql

将PGDATA设置为postgresql的数据目录路径:/usr/local/postgresql/data

将PGUSER设置为postgresql的用户:admin

将PGLOG 设置为 postgresql 的数据目录的日志文件夹下:$PGDATA/pg_log/serverlog

保存退出!

3、 添加到开机启动

修改文件属性:

# chmod a+x postgresql   

添加开机启动:

# chkconfig --add postgresql 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM