Tell me more ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I need Postgresql configured to start with the Upstart system because i use Upstarts events to start another app which depends on pgsql to be running. This is the tutorial/script i've used:

http://bradleyayers.blogspot.com/2011/10/upstart-job-for-postgresql-91-on-ubuntu.html

When i restart the server (shutdown -r now), postgresql isnt running (not visible as a job via 'top' command). I then tried running only the following command manually:

root@server:~# exec su -c "/usr/lib/postgresql/9.1/bin/postgres -D /var/lib/postgresql/9.1/main -c config_file=/etc/postgresql/9.1/main/postgresql.conf" postgres

and my ssh session simply disconects not returning anything. If i reconnect and again check running jobs, pgsql is still not running. So i tried running the command without 'exec' and here is the response:

root@server:~# su -c "/usr/lib/postgresql/9.1/bin/postgres -D /var/lib/postgresql/9.1/main -c config_file=/etc/postgresql/9.1/main/postgresql.conf" postgres

2012-12-03 19:31:36 MSK FATAL:  could not create lock file "/var/run/postgresql/.s.PGSQL.5432.lock": No such file or directory

I assume the problem is related to postgresql itself not upstart system. I suppose the file it mentions should exist so it can be accessed but it doesn't for some reason. did someone else stumble upon this, or has a potential solution to this?

share|improve this question

1 Answer

Error means Postgres cannot create its lock file into /var/run/postgresql directory. The pre-script is expected to create it, and it is setting ownership to postgres. To me, it just looks like this script has not run at all. So check the output of start postgres (as superuser), existence and permissions ls -l /var/run/postgresql.

FYI: exec is useful in Upstart jobs so the script section running a shell script does not leave an additional PID floating around. In a shell session, it makes your shell quit when executed program exits.

share|improve this answer
I've made Upstart save a log when it runs the script. It seems theres a syntax error in the script itself. I ll dig some more. Thanks for the idea tho – U2ros Dec 7 '12 at 6:43

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.