这个postgresql.service文件有什么意义?

这个“服务”似乎运行/ bin / true,但为什么? 还有另一个postgresql @ .service文件,但是为什么这个文件存在呢? 是的,这是整个文件。

# 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 

这只是一个虚拟服务,通过服务依赖关系启动实际的PostgreSQL的触发器。 /bin/true只是使它看起来像已经成功启动,而没有实际做任何事情。

顶部的意见是清楚的,并解释使用。 每个集群都有自己的单元文件postgresql @ version-cluster,它们都是“PartOf = postgresql.service”。 因此,这个单元允许用systemctl start postgresql和其他服务来启动所有集群,以依赖处于特定状态(例如,启动)的所有集群。