我有两个版本的服务,我偶尔想在它们之间切换 - my-service-a 和 my-service-b。我希望 my-service-a 始终是系统启动时正在运行的那个。目前,要在它们之间切换,我必须运行多个命令,例如从 a 切换到 b
systemctl stop my-service-a
systemctl start my-service-b
Run Code Online (Sandbox Code Playgroud)
并且 systemd 没有强制执行一次只有一个运行 - 我只需要小心。
在 systemd 中是否有对这种情况的直接支持?我可以将其视为对服务之间“切换”或模板化服务的实例化的支持,或者我可以将其视为对互斥服务的支持,因此当我启动 my-service-b 时,my-service-a自动停止。或者也许完全有另一种方式。
我的笔记本电脑有时会在盖子合上时挂起,有时不会。这是 journalctl 的一些输出,显示挂起触发可能是五六分之一
-- Logs begin at Sat 2015-02-14 17:45:21 PST, end at Tue 2015-08-18 10:53:09 PDT. --
Aug 18 08:51:05 gurney systemd[1]: Starting Login Service...
Aug 18 08:51:06 gurney systemd-logind[658]: New seat seat0.
Aug 18 08:51:06 gurney systemd[1]: Started Login Service.
Aug 18 08:51:06 gurney systemd-logind[658]: Watching system buttons on /dev/input/event5 (Power Button)
Aug 18 08:51:06 gurney systemd-logind[658]: Watching system buttons on /dev/input/event7 (Video Bus)
Aug 18 08:51:06 gurney systemd-logind[658]: Watching system buttons on /dev/input/event3 (Lid Switch)
Aug 18 …
Run Code Online (Sandbox Code Playgroud)