我想在 autofs 启动之前和之后运行脚本。我有两个系统服务:
backup1.service 在 autofs 之前运行
[Unit]
Description=Backup mount
[Service]
ExecStart=/backup/sw/bmount before
[Install]
WantedBy=autofs.service
Run Code Online (Sandbox Code Playgroud)
backup2.service 在 autofs 之后运行
[Unit]
Description=Backup mount
PartOf=autofs.service
After=autofs.service
[Service]
ExecStart=/backup/sw/bmount after
[Install]
WantedBy=autofs.service
Run Code Online (Sandbox Code Playgroud)
我可以确定 bmount 脚本中的前后状态,因此我可以不带参数调用它,并且我只能使用一项服务,但不知道如何使用。
是否可以?