I need to run postgresql for my Rails app, which I do like this at the terminal:
$ sudo service postgresql start
How do I automate this process so that postgresql just starts automatically for me either whenever my app needs it, whenever I login, or whenever my server starts. I'm on Ubuntu 15.10.
Thanks.
Auto start PostgreSQL on OS startup.
I'm not sure about, which OS you're using. On Ubuntu it should be:
sudo update-rc.d postgresql enable
There are several ways to auto start a program per OS. Better consult to your specific OS docs.
Stale PID needs removal. First step
rm /usr/local/var/postgres/postmaster.pid
Second step
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
I do not know exactly the procedures you used to install postgres , but when I installed Ubuntu 10.15 had permission issues that prevented the service from starting.
1 ) try to start:
service postgresql start
2 ) make sure that Postgres is the list of services:
ps -ef
3 ) If not, check the log:
cat /var/log/syslog
4 ) At this point my problem was allowed access to the ssl key. If your case also, do:
chown postgres. /etc/ssl/private/ssl-cert-snakeoil.key
5 ) try to start again:
service postgresql start
With this my Postgres started normally (forever)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.