相关疑难解决方法(0)

postinst 维护者脚本阻止 systemd 单元文件在安装时自动启动

我正在创建一个小的 Debian 包来安装 systemd 单元文件,特别是*.service文件。

我的包裹看起来像:

myservice
      | 
      |--debian
            |- comapat
            |- preinst
            |- postinst
            |- rules
            |- myservice.service
Run Code Online (Sandbox Code Playgroud)

当我安装我的软件包时,systemd 服务会自动禁用并且不会启动。

安装后立即systemctl status myservice显示

root@ubuntu-xenial:~# systemctl status myservice
  ? myservice.service - My Service - echos output and says when it started
  Loaded: loaded (/lib/systemd/system/myservice.service; disabled; vendor preset: enabled)
  Active: inactive (dead)
Run Code Online (Sandbox Code Playgroud)

但是,当我在没有postinst脚本的情况下安装我的包时,systemd 服务会自动启用,并且它们会在安装后启动。

root@ubuntu-xenial:~# systemctl status myservice
? myservice.service - MyService - echos output and says when it started
Loaded: loaded (/lib/systemd/system/myservice.service; …
Run Code Online (Sandbox Code Playgroud)

ubuntu debian systemd

1
推荐指数
1
解决办法
1666
查看次数

标签 统计

debian ×1

systemd ×1

ubuntu ×1