postgresql设置开机自启动

1、修改$GP_HOME/contrib/start-scripts/linux 文件

# Installation prefix
#prefix=/usr/local/pgsql
#安装路径
prefix=/home/postgres
#echo "-----$prefix-----"
# Data directory
#PGDATA="/usr/local/pgsql/data"
#数据存放路径
PGDATA="/opt/unisinsight/database/pgdata"

2、将linux文件拷贝到/etc/init.d/目录下,并命名为postgresql

[root@console start-scripts]# pwd
/opt/unisinsight/postgresql-10.5/contrib/start-scripts
[root@console start-scripts]# vim linux 
[root@console start-scripts]# cp linux /etc/init.d/postgresql

3、修改文件执行权限

[root@console start-scripts]# cd /etc/init.d/
[root@console init.d]# ls
functions  mysqld  netconsole  network  postgresql  README
[root@console init.d]# chmod a+x postgresql 
[root@console init.d]# ll
total 56
-rw-r--r--. 1 root  root  18281 Aug 24  2018 functions
-rwxr-xr-x. 1 mysql mysql 10975 Feb  2  2016 mysqld
-rwxr-xr-x. 1 root  root   4569 Aug 24  2018 netconsole
-rwxr-xr-x. 1 root  root   7923 Aug 24  2018 network
-rwxr-xr-x. 1 root  root   3583 May  7 06:25 postgresql
-rw-r--r--. 1 root  root   1160 Jan 14 23:10 README

4、启动服务

[root@console init.d]# service postgresql restart
Restarting PostgreSQL: ok
[root@console init.d]# service postgresql stop
Stopping PostgreSQL: ok
[root@console init.d]# service postgresql start
Starting PostgreSQL: ok

5、设置开机自启动

[root@console init.d]# chkconfig --add postgresql
[root@console init.d]# chkconfig --list postgresql

Note: This output shows SysV services only and does not include native
      systemd services. SysV configuration data might be overridden by native
      systemd configuration.

      If you want to list systemd services use 'systemctl list-unit-files'.
      To see services enabled on particular target use
      'systemctl list-dependencies [target]'.

postgresql     	0:off	1:off	2:on	3:on	4:on	5:on	6:off
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值