[CentOS] pgbouncer.pid Permissions on CentOS 7

Fri Jul 31 23:40:33 UTC 2020
Bee.Lists <bee.lists at gmail.com>

I’ve installed pgbouncer on CentOS7 and it’s reliant upon a .pid file:

  2020-07-31 04:58:34.082 EDT [3682] DEBUG parse_ini_file: 'logfile' = '/var/log/pgbouncer/pgbouncer.log'
  2020-07-31 04:58:34.082 EDT [3682] DEBUG parse_ini_file: 'logfile' = '/var/log/pgbouncer/pgbouncer.log' ok:1
  2020-07-31 04:58:34.082 EDT [3682] DEBUG parse_ini_file: 'pidfile' = '/var/run/pgbouncer/pgbouncer.pid'
  2020-07-31 04:58:34.082 EDT [3682] DEBUG parse_ini_file: 'pidfile' = '/var/run/pgbouncer/pgbouncer.pid' ok:1

However the service isn’t starting because the ownership of the parent directory, pgbouncer:pgbouncer results in some permissions issues:

  2020-07-31 04:58:34.089 EDT [3682] FATAL could not open pidfile '/var/run/pgbouncer/pgbouncer.pid': Permission denied

/var/run/ has special flushing behaviour which I want to retain, but I need to get around this permission issue.  Changing ownership on this directory just results in an automatic ownership set by the service, so that’s not an option.  

- Is there another location that can achieve this? 
- Is there any other way to solve this?

I can’t find anything online, other than the same permissions issue for .pid files in this location.



Cheers, Bee