1. svscanboot was ran and added to autostart
  2. added script from article http://thedjbway.b0llix.net/services/postgresql.html to /service/postgres/run and change mode a+x,root owner
  3. Add service: svc -u /service/postgres
  4. Check svstat /service/postgres, script not ran

1 Answer 1


Following that tutorial all of the way through, you should have a log service, too. The log service will have information in its log file(s) about why the main service failed. You can read the log file(s) with tail, grep, and less.

Vanilla daemontools' svstat only tells you whether a service is currently up or down. You have no basis for asserting that the script did not run. Indeed, it very probably did run; and the error messages in the log service's log file(s) will tell you what error messages it output when it did.

You can, of course, make the script explain more of its operations in a perfectly ordinary way. It is a #!/bin/sh interpreted script after all, and the shell's -v and -x options can thus be used just as in any other shell script.

The likeliest candidate for what you'll find in your logs is that postmaster isn't on your PATH and is in a subdirectory of somewhere like /usr/lib/postgresql/ or /usr/local/pgsql. In this case either you have to invoke it as /usr/lib/postgresql/bin/postmaster or you have to prepend /usr/lib/postgresql/bin/ to your path within the script so that it finds the program when it is invoked as plain old unadorned postmaster. This latter is explained in the PostgreSQL documentation, q.v..

Further reading

  • + CLUSTER=/var/lib/pgsql/9.5/data + exec + echo '*** Starting postgresql on data /var/lib/pgsql/9.5/data' *** Starting postgresql on data /var/lib/pgsql/9.5/data + exec setuidgid postgres /usr/pgsql-9.5/bin/postmaster -D /var/lib/pgsql/9.5/data -p 5432 < 2016-10-06 22:07:20.921 MSK >LOG: redirecting log output to logging collector process < 2016-10-06 22:07:20.921 MSK >HINT: Future log output will appear in directory "pg_log".
    – shkiper
    Oct 6, 2016 at 16:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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