问题原文
原帖链接 · arcee123 · CC BY-SA 3.0
I've installed postgresql 9.6.2 from running from source. I performed the .configure, make and make install commands, which installed the database perfectly. I then installed the user, created the db using createdb command, and am able to log in locally to postgresql user to perform local sql queries.
My question is autostart. How do I set it up so autostart is working? the command service postgresql restart errors saying no unit. I also tried postgresql-9.6, postgresql-9.6.2, postgresql-962, and several others to no avail.
how to I configure this? Thanks.
已采纳解答
原帖链接 · user653399 · CC BY-SA 4.0
When using systemd, you can use the following service unit file (e.g., at /etc/systemd/system/postgresql.service):
[Unit]
Description=PostgreSQL database server
Documentation=man:postgres(1)
[Service]
Type=notify
User=postgres
ExecStart=/usr/pgsql-9.5/bin/pg_ctl -D /bd-01/pgsql/9.5/data -l logfile start
ExecReload=/bin/kill -HUP $MAINPID
KillMode=mixed
KillSignal=SIGINT
TimeoutSec=0
[Install]
WantedBy=multi-user.target
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
