PostgreSQL在CentOS上没有服务名称
发布时间:2020-12-13 16:24:26 所属栏目:百科 来源:网络整理
导读:我在CentOS 5.5上以一种非常标准的方式安装了PostgreSQL: rpm -ivh http://yum.pgrpms.org/reporpms/9.0/pgdg-centos-9.0-2.noarch.rpmyum install postgresql90-server postgresql90-contribchkconfig postgresql-90 on/etc/init.d/postgresql-90 initdb
我在CentOS 5.5上以一种非常标准的方式安装了PostgreSQL:
rpm -ivh http://yum.pgrpms.org/reporpms/9.0/pgdg-centos-9.0-2.noarch.rpm yum install postgresql90-server postgresql90-contrib chkconfig postgresql-90 on /etc/init.d/postgresql-90 initdb 但由于某种原因,我不能将它与service命令一起使用,因为它没有名称,.如果我服务–status-所有我得到以下内容: master (pid 3095) is running... (pid 3009) is running... rdisc is stopped 甚至只是/etc/init.d/postgresql-90状态: (pid 3009) is running... 那么我怎么能给它一个名字,这样我每次都不必输入整个init脚本路径?
服务名称只是脚本的名称,即postgresql-90.
但是,我刚刚在init脚本上面的命令后面安装了postgres实际上叫做postgresql-9.0,而不是postgresql-90. $sudo /sbin/service postgresql-9.0 status (pid 16670) is running... 我敢肯定你很想知道它为什么不告诉你服务的名称,不是吗?这是因为/etc/rc.d/init.d/postgresql-9.0没有正确调用函数状态: status -p /var/run/postmaster-${PGMAJORVERSION}.${PGPORT}.pid 来自/etc/rc.d/init.d/functions: status() { local base pid pid_file= # Test syntax. if [ "$#" = 0 ] ; then echo $"Usage: status [-p pidfile] {program}" return 1 fi ... 因此/etc/rc.d/init.d/postgresql-9.0应该是 status -p /var/run/postmaster-${PGMAJORVERSION}.${PGPORT}.pid $0 并且输出正确: $sudo /sbin/service postgresql-9.0 status postgresql-9.0 (pid 16670) is running... (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |