[plug] Postgresql 9.4 on Debian Jessie

Rob rob at mrrob.info
Fri Sep 12 01:07:56 UTC 2014


On 11/09/14 18:07, Marcus Holmes wrote:
> so I was happily on 9.3 and then I moved to Jessie (so I could get
> Docker working, a whole other story), which upgraded me to 9.4, but the
> upgrade flunked the database upgrade so I was left running mismatched
> versions of database and server (or something... it wasn't happy
> anyway). So. nuke the site from orbit, purge everything and start again.
> Lucky it was all just dev and test databases.
>
> But, and here's the problem: Jessie uses systemd and the 9.4 install
> doesn't seem to actually create the .service files needed to kick the
> server off on boot (it does come with a lovely init.d script that then
> doesn't appear to get called by systemd). And I can't find a decent
> guide to writing .service files for 9.4 anywhere.
>
> Anyone know of a way of either getting systemd to call the init.d
> script, or better yet, a decent guide for the uninitiated on writing a
> .service file?
>
> Thanks in advance for any help...
>
> Marcus
>
>
>
> _______________________________________________
> PLUG discussion list: plug at plug.org.au
> http://lists.plug.org.au/mailman/listinfo/plug
> Committee e-mail: committee at plug.org.au
> PLUG Membership: http://www.plug.org.au/membership
>

I can't give any advice as to where to learn to write them but below is 
the Arch Linux postgresql-testing(ver. 9.4beta2) postgresql.service 
file.  I retrieved it from: 
https://aur.archlinux.org/packages/po/postgresql-testing/postgresql-testing.tar.gz. 
I'm sure you could make a basic one to execute the init.d scripts if 
this doesn't work.

[Unit]
Description=PostgreSQL database server
After=network.target

[Service]
Type=forking
TimeoutSec=120
User=postgres
Group=postgres

Environment=PGROOT=/var/lib/postgres

SyslogIdentifier=postgres
PIDFile=/var/lib/postgres/data/postmaster.pid

ExecStartPre=/usr/bin/postgresql-check-db-dir ${PGROOT}/data
ExecStart= /usr/bin/pg_ctl -s -D ${PGROOT}/data start -w -t 120
ExecReload=/usr/bin/pg_ctl -s -D ${PGROOT}/data reload
ExecStop=  /usr/bin/pg_ctl -s -D ${PGROOT}/data stop -m fast

# Due to PostgreSQL's use of shared memory, OOM killer is often 
overzealous in
# killing Postgres, so adjust it downward
OOMScoreAdjust=-200

[Install]
WantedBy=multi-user.target


---
mrrob
---


More information about the plug mailing list