This "services" appears to run /bin/true, but why? There is another [email protected] file as well, but why does this one exist at all? Yes, this is the entire file.
# systemd service for managing all PostgreSQL clusters on the system. This
# service is actually a systemd target, but we are using a service since
# targets cannot be reloaded.
[Unit]
Description=PostgreSQL RDBMS
[Service]
Type=oneshot
ExecStart=/bin/true
ExecReload=/bin/true
RemainAfterExit=on
[Install]
WantedBy=multi-user.target
This is just a dummy service, a trigger that starts the actual PostgreSQL through service dependencies. The
/bin/true
just makes it to look like it has started successfully, without actually doing anything.The comments at the top are clear and explain the use. Each cluster has its own unit file postgresql@version-cluster and they are all "PartOf=postgresql.service". Thus this unit allows one to start up all clusters with
systemctl start postgresql
and other services to depend on all clusters being in a particular state (e.g., started).