Debian 10에서는 서비스가 자동으로 시작됩니다.

Debian 10에서는 서비스가 자동으로 시작됩니다.

debian 10이전에 unbound service. 오늘 나는 서비스가 1분마다 재설정된다는 것을 알았습니다. 파일을 수동으로 삭제 /lib/systemd/system/unbound.service하고 프로세스를 종료했지만 자동으로 다시 실행되는 프로세스가 이 서비스를 두 번 실행하는지 이해할 수 없습니다. 두 가지 질문이 있습니다.

#1: 서비스를 자동으로 다시 시작하는 방법은 무엇입니까?

‍#2: 서비스가 이미 시작된 경우 왜 재설정해야 하나요?

또한 재설정이 서비스 자체 때문이라고 생각하지 않습니다.

    unbound.service
   Loaded: loaded (/etc/init.d/unbound; generated)
   Active: active (running) since Sun 2022-05-01 14:57:25 +0430; 50s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 24965 ExecStart=/etc/init.d/unbound start (code=exited, status=0/SUCCESS)
 Main PID: 24985 (unbound)
    Tasks: 8 (limit: 4915)
   Memory: 14.3M
   CGroup: /system.slice/unbound.service
                 24985 /usr/sbin/unbound

May 01 14:57:24 INF-dns-ntp02 systemd[1]: Starting unbound.service...
May 01 14:57:24 INF-dns-ntp02 unbound-anchor[24980]: /var/lib/unbound/root.key has content
May 01 14:57:24 INF-dns-ntp02 unbound-anchor[24980]: success: the anchor is ok
May 01 14:57:25 INF-dns-ntp02 unbound[24965]: Starting DNS server: unbound.
May 01 14:57:25 INF-dns-ntp02 systemd[1]: Started unbound.service.

고쳐 쓰다:목록 파일

/etc/apparmor.d/local/usr.sbin.unbound
/etc/apparmor.d/usr.sbin.unbound
/etc/init.d/unbound
/etc/insserv.conf.d/unbound
/etc/resolvconf/update.d/unbound
/etc/systemd/system/multi-user.target.wants/unbound.service -> /lib/systemd/system/unbound.service
/etc/systemd/system/unbound.service.d
/etc/systemd/system/unbound.service.wants
/etc/systemd/system/unbound.service.wants/unbound-resolvconf.service -> /lib/systemd/system/unbound-resolvconf.service
/etc/unbound
/etc/unbound/unbound.conf
/etc/unbound/unbound.conf.bk
/etc/unbound/unbound.conf.d
/run/systemd/generator.late/graphical.target.wants/unbound.service -> ../unbound.service
/run/systemd/generator.late/multi-user.target.wants/unbound.service -> ../unbound.service
/run/systemd/generator.late/unbound.service
/run/systemd/units/invocation:unbound.service -> ff49954ca79b45bf851f4f6c9eb007da
/usr/lib/x86_64-linux-gnu/libunbound.so.8 -> libunbound.so.8.1.0
/usr/lib/x86_64-linux-gnu/libunbound.so.8.1.0
/usr/sbin/unbound
/usr/sbin/unbound-anchor
/usr/sbin/unbound-checkconf
/usr/sbin/unbound-control
/usr/sbin/unbound-control-setup
/usr/share/doc/libunbound8
/usr/share/doc/unbound
/usr/share/doc/unbound-anchor

업데이트 2: 모두 제거/etc/rc*/[ks]unbound

 unbound.service
   Loaded: loaded (/etc/init.d/unbound; generated)
   Active: active (running) since Sun 2022-05-01 18:22:25 +0430; 5s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 4854 ExecStart=/etc/init.d/unbound start (code=exited, status=0/SUCCESS)
 Main PID: 4873 (unbound)
    Tasks: 8 (limit: 4915)
   Memory: 13.6M
   CGroup: /system.slice/unbound.service
                 4873 /usr/sbin/unbound

May 01 18:22:24 INF-dns-ntp02 systemd[1]: Starting unbound.service...
May 01 18:22:25 INF-dns-ntp02 unbound-anchor[4868]: /var/lib/unbound/root.key has content
May 01 18:22:25 INF-dns-ntp02 unbound-anchor[4868]: success: the anchor is ok
May 01 18:22:25 INF-dns-ntp02 unbound[4854]: Starting DNS server: unbound.
May 01 18:22:25 INF-dns-ntp02 systemd[1]: Started unbound.service.

Kill Main PID: 4873 exec kill -9 4873 그러나 바인딩되지 않은 서비스는 자동으로 다시 시작됩니다...

업데이트 3: grep -r unbound /etc

output: 

/etc/apparmor.d/usr.sbin.unbound:/usr/sbin/unbound flags=(attach_disconnected) {
/etc/apparmor.d/usr.sbin.unbound:  /etc/unbound/** r,
/etc/apparmor.d/usr.sbin.unbound:  owner /etc/unbound/*.key* rw,
/etc/apparmor.d/usr.sbin.unbound:  audit deny /etc/unbound/unbound_control.{key,pem} rw,
/etc/apparmor.d/usr.sbin.unbound:  audit deny /etc/unbound/unbound_server.key w,
/etc/apparmor.d/usr.sbin.unbound:  /var/lib/unbound/** r,
/etc/apparmor.d/usr.sbin.unbound:  owner /var/lib/unbound/** rw,
/etc/apparmor.d/usr.sbin.unbound:  audit deny /var/lib/unbound/**/unbound_control.{key,pem} rw,
/etc/apparmor.d/usr.sbin.unbound:  audit deny /var/lib/unbound/**/unbound_server.key w,
/etc/apparmor.d/usr.sbin.unbound:  /usr/sbin/unbound mr,
/etc/apparmor.d/usr.sbin.unbound:  /{,var/}run/{unbound/,}unbound.pid rw,
/etc/apparmor.d/usr.sbin.unbound:  /{,var/}run/unbound.ctl rw,
/etc/apparmor.d/usr.sbin.unbound:  #include <local/usr.sbin.unbound>

답변1

서비스는 여러 가지 방법으로 시작할 수 있습니다. 명령을 실행할 때 표시됩니다.

sudo systemctl status servicname

"트리거"라는 제목 아래에 있습니다.

이는 개별적으로 중지, 시작, 활성화, 비활성화, 차단 및 차단 해제가 가능합니다.

다른 서비스의 예:

    sudo systemctl status libvirtd.service
● libvirtd.service - Virtualization daemon
     Loaded: loaded (/lib/systemd/system/libvirtd.service; enabled; vendor preset: enabled)
     Active: active (running) since Thu 2022-04-28 17:26:32 CEST; 2 days ago
TriggeredBy: ● libvirtd-ro.socket
             ● libvirtd-admin.socket
             ● libvirtd.socket
       Docs: man:libvirtd(8)

관련 정보