我想安装一个 systemd 服务+计时器,但它与我的包名不匹配。
# debian/mypackage.myscript.timer
[Timer]
OnCalendar=weekly
Persistent=true
[Install]
WantedBy=timers.target
# debian/mypackage.myscript.service
[Service]
ExecStart=/usr/bin/myscript
# debian/rules
%:
dh $@
override_dh_installsystemd:
dh_installsystemd --name=myscript
但安装后我得到:
Setting up mypackage (1.38) ...
Created symlink /etc/systemd/system/timers.target.wants/myscript.timer → /lib/systemd/system/myscript.timer.
myscript.service is a disabled or a static unit, not starting it.
我怎样才能隐藏最后一条消息?
我试过:
dh_installsystemd --name=myscript --no-start
这确实解决了安装消息。但是,它会阻止计时器启动。
答案1
通过显式定义单元文件来独立对待*.service
和:*.timer
override_dh_installsystemd:
dh_installsystemd --name=myscript myscript.service --no-start
dh_installsystemd --name=myscript myscript.timer