postgres有源码安装,yum安装,或者下载包自己rpm,安装方法众多。
以前一台yum安装postgres的机器设置了
systemctl enable postgresql
这样postgresql就可以开机自启动了。
我测试了源码安装,并不支持这个命令。
可见,yum安装包偷偷的对systemctl命令进行了一些注册相关的操作?
那么研究一下,执行
[root@db222 ~]# systemctl status postgresql
postgresql.service - PostgreSQL database server
Loaded: loaded (/usr/lib/systemd/system/postgresql.service; enabled)
Active: active (running) since Fri 2015-06-19 10:19:23 CST; 3 days ago
Process: 1104 ExecStart=/usr/bin/pg_ctl start -D ${PGDATA} -s -o -p ${PGPORT} -w -t 300 (code=exited, status=0/SUCCESS)
Process: 1068 ExecStartPre=/usr/bin/postgresql-check-db-dir ${PGDATA} (code=exited, status=0/SUCCESS)
Main PID: 1153 (postgres)
CGroup: /system.slice/postgresql.service
├─1153 /usr/bin/postgre