[systemd-devel] start service in multi-user.target but don't stop it on isolate
Jérémy Rosen
jeremy.rosen at smile.fr
Tue Mar 20 09:34:19 UTC 2018
naive question, but why are you not using systemd's handling of hardware
daemon (see man:system.conf for how to activate it)
basically, systemd is monitored by the hardware daemon and systemd
monitors (via its software watchdog) any service that wants to be monitored
this creates a better chain of trust (I think) than an external daemon
and would do what you want...
On 19/03/2018 14:39, Alexander 'Leo' Bergolth wrote:
> Hi!
>
> I am using the software watchdog daemon together with a watchdog device in "nowayout" mode.
> Thus once started, the watchdog daemon should never be stopped or the box will be rebooted.
>
> watchdog.service is WantedBy multi-user.target and when changing e.g. to rescue.target, it should stay active.
>
> I tried to configure this using IgnoreOnIsolate=true but this doesn't show the desired effect.
> On "systemd isolate rescue.target", watchdog.service still gets stopped:
> -------------------- 8< --------------------
> Mar 19 13:44:02 strike watchdog[1291]: stopping daemon (5.13)
> Mar 19 13:44:02 strike systemd[1]: Stopping watchdog daemon...
> -------------------- 8< --------------------
>
> What did I do wrong?
>
> Cheers,
> --leo
>
>
> I am using systemd-219-42.el7_4.7.x86_64 on Centos 7.
>
> -------------------- 8< --------------------
> # systemctl cat watchdog.service
> # /usr/lib/systemd/system/watchdog.service
> [Unit]
> Description=watchdog daemon
> # man systemd.special
> # auto added After=basic.target
>
> [Service]
> Type=forking
> ExecStart=/usr/sbin/watchdog
> ControlGroup=cpu:/
>
> [Install]
> WantedBy=multi-user.target
>
> # /etc/systemd/system/watchdog.service.d/override.conf
> [Unit]
> IgnoreOnIsolate=true
>
> -------------------- 8< --------------------
> # systemctl status watchdog.service
> * watchdog.service - watchdog daemon
> Loaded: loaded (/usr/lib/systemd/system/watchdog.service; enabled; vendor preset: disabled)
> Drop-In: /etc/systemd/system/watchdog.service.d
> `-override.conf
> Active: inactive (dead) since Mon 2018-03-19 13:44:07 CET; 23min ago
> Process: 1267 ExecStart=/usr/sbin/watchdog (code=exited, status=0/SUCCESS)
> Main PID: 1291 (code=exited, status=0/SUCCESS)
>
> -------------------- 8< --------------------
> # systemctl show watchdog.service
> Type=forking
> Restart=no
> NotifyAccess=none
> RestartUSec=100ms
> TimeoutStartUSec=1min 30s
> TimeoutStopUSec=1min 30s
> WatchdogUSec=0
> WatchdogTimestampMonotonic=0
> StartLimitInterval=10000000
> StartLimitBurst=5
> StartLimitAction=none
> FailureAction=none
> PermissionsStartOnly=no
> RootDirectoryStartOnly=no
> RemainAfterExit=no
> GuessMainPID=yes
> MainPID=0
> ControlPID=0
> FileDescriptorStoreMax=0
> StatusErrno=0
> Result=success
> ExecMainStartTimestamp=Mon 2018-03-19 13:42:22 CET
> ExecMainStartTimestampMonotonic=15052342
> ExecMainExitTimestamp=Mon 2018-03-19 13:44:07 CET
> ExecMainExitTimestampMonotonic=119544736
> ExecMainPID=1291
> ExecMainCode=1
> ExecMainStatus=0
> ExecStart={ path=/usr/sbin/watchdog ; argv[]=/usr/sbin/watchdog ; ignore_errors=no ; start_time=[Mon 2018-03-19 13:42:22 CET] ; stop_time=[Mon 2018-03-19 13:42:22 CET] ; pid=12
> Slice=system.slice
> MemoryCurrent=18446744073709551615
> TasksCurrent=18446744073709551615
> Delegate=no
> CPUAccounting=no
> CPUShares=18446744073709551615
> StartupCPUShares=18446744073709551615
> CPUQuotaPerSecUSec=infinity
> BlockIOAccounting=no
> BlockIOWeight=18446744073709551615
> StartupBlockIOWeight=18446744073709551615
> MemoryAccounting=no
> MemoryLimit=18446744073709551615
> DevicePolicy=auto
> TasksAccounting=no
> TasksMax=18446744073709551615
> UMask=0022
> LimitCPU=18446744073709551615
> LimitFSIZE=18446744073709551615
> LimitDATA=18446744073709551615
> LimitSTACK=18446744073709551615
> LimitCORE=18446744073709551615
> LimitRSS=18446744073709551615
> LimitNOFILE=4096
> LimitAS=18446744073709551615
> LimitNPROC=63090
> LimitMEMLOCK=65536
> LimitLOCKS=18446744073709551615
> LimitSIGPENDING=63090
> LimitMSGQUEUE=819200
> LimitNICE=0
> LimitRTPRIO=0
> Type=forking
> Restart=no
> NotifyAccess=none
> RestartUSec=100ms
> TimeoutStartUSec=1min 30s
> TimeoutStopUSec=1min 30s
> WatchdogUSec=0
> WatchdogTimestampMonotonic=0
> StartLimitInterval=10000000
> StartLimitBurst=5
> StartLimitAction=none
> FailureAction=none
> PermissionsStartOnly=no
> RootDirectoryStartOnly=no
> RemainAfterExit=no
> GuessMainPID=yes
> MainPID=0
> ControlPID=0
> FileDescriptorStoreMax=0
> StatusErrno=0
> Result=success
> ExecMainStartTimestamp=Mon 2018-03-19 13:42:22 CET
> ExecMainStartTimestampMonotonic=15052342
> ExecMainExitTimestamp=Mon 2018-03-19 13:44:07 CET
> ExecMainExitTimestampMonotonic=119544736
> ExecMainPID=1291
> ExecMainCode=1
> ExecMainStatus=0
> ExecStart={ path=/usr/sbin/watchdog ; argv[]=/usr/sbin/watchdog ; ignore_errors=no ; start_time=[Mon 2018-03-19 13:42:22 CET] ; stop_time=[Mon 2018-03-19 13:42:22 CET] ; pid=12
> Slice=system.slice
> MemoryCurrent=18446744073709551615
> TasksCurrent=18446744073709551615
> Delegate=no
> CPUAccounting=no
> CPUShares=18446744073709551615
> StartupCPUShares=18446744073709551615
> CPUQuotaPerSecUSec=infinity
> BlockIOAccounting=no
> BlockIOWeight=18446744073709551615
> StartupBlockIOWeight=18446744073709551615
> MemoryAccounting=no
> MemoryLimit=18446744073709551615
> DevicePolicy=auto
> TasksAccounting=no
> TasksMax=18446744073709551615
> UMask=0022
> LimitCPU=18446744073709551615
> LimitFSIZE=18446744073709551615
> LimitDATA=18446744073709551615
> LimitSTACK=18446744073709551615
> LimitCORE=18446744073709551615
> LimitRSS=18446744073709551615
> LimitNOFILE=4096
> LimitAS=18446744073709551615
> LimitNPROC=63090
> LimitMEMLOCK=65536
> LimitLOCKS=18446744073709551615
> LimitSIGPENDING=63090
> LimitMSGQUEUE=819200
> LimitNICE=0
> LimitRTPRIO=0
> LimitRTTIME=18446744073709551615
> OOMScoreAdjust=0
> Nice=0
> IOScheduling=0
> CPUSchedulingPolicy=0
> CPUSchedulingPriority=0
> TimerSlackNSec=50000
> CPUSchedulingResetOnFork=no
> NonBlocking=no
> StandardInput=null
> StandardOutput=journal
> StandardError=inherit
> TTYReset=no
> TTYVHangup=no
> TTYVTDisallocate=no
> SyslogPriority=30
> SyslogLevelPrefix=yes
> SecureBits=0
> CapabilityBoundingSet=18446744073709551615
> AmbientCapabilities=0
> MountFlags=0
> PrivateTmp=no
> PrivateNetwork=no
> PrivateDevices=no
> ProtectHome=no
> ProtectSystem=no
> SameProcessGroup=no
> IgnoreSIGPIPE=yes
> NoNewPrivileges=no
> SystemCallErrorNumber=0
> RuntimeDirectoryMode=0755
> KillMode=control-group
> KillSignal=15
> SendSIGKILL=yes
> SendSIGHUP=no
> Id=watchdog.service
> Names=watchdog.service
> Requires=basic.target
> Wants=system.slice
> WantedBy=multi-user.target
> Conflicts=shutdown.target
> Before=multi-user.target shutdown.target
> After=basic.target systemd-journald.socket system.slice
> Description=watchdog daemon
> LoadState=loaded
> ActiveState=inactive
> SubState=dead
> FragmentPath=/usr/lib/systemd/system/watchdog.service
> DropInPaths=/etc/systemd/system/watchdog.service.d/override.conf
> UnitFileState=enabled
> UnitFilePreset=disabled
> InactiveExitTimestamp=Mon 2018-03-19 13:42:22 CET
> InactiveExitTimestampMonotonic=14539954
> ActiveEnterTimestamp=Mon 2018-03-19 13:42:22 CET
> ActiveEnterTimestampMonotonic=15052358
> ActiveExitTimestamp=Mon 2018-03-19 13:44:02 CET
> ActiveExitTimestampMonotonic=114543976
> InactiveEnterTimestamp=Mon 2018-03-19 13:44:07 CET
> InactiveEnterTimestampMonotonic=119544801
> CanStart=yes
> CanStop=yes
> CanReload=no
> CanIsolate=no
> StopWhenUnneeded=no
> RefuseManualStart=no
> RefuseManualStop=no
> AllowIsolate=no
> DefaultDependencies=yes
> OnFailureJobMode=replace
> IgnoreOnIsolate=yes
> IgnoreOnSnapshot=no
> NeedDaemonReload=no
> JobTimeoutUSec=0
> JobTimeoutAction=none
> ConditionResult=yes
> AssertResult=yes
> ConditionTimestamp=Mon 2018-03-19 13:42:22 CET
> ConditionTimestampMonotonic=14539719
> AssertTimestamp=Mon 2018-03-19 13:42:22 CET
> AssertTimestampMonotonic=14539719
> Transient=no
> [root at strike systemd]# systemctl show watchdog.service | cat
> Type=forking
> Restart=no
> NotifyAccess=none
> RestartUSec=100ms
> TimeoutStartUSec=1min 30s
> TimeoutStopUSec=1min 30s
> WatchdogUSec=0
> WatchdogTimestampMonotonic=0
> StartLimitInterval=10000000
> StartLimitBurst=5
> StartLimitAction=none
> FailureAction=none
> PermissionsStartOnly=no
> RootDirectoryStartOnly=no
> RemainAfterExit=no
> GuessMainPID=yes
> MainPID=0
> ControlPID=0
> FileDescriptorStoreMax=0
> StatusErrno=0
> Result=success
> ExecMainStartTimestamp=Mon 2018-03-19 13:42:22 CET
> ExecMainStartTimestampMonotonic=15052342
> ExecMainExitTimestamp=Mon 2018-03-19 13:44:07 CET
> ExecMainExitTimestampMonotonic=119544736
> ExecMainPID=1291
> ExecMainCode=1
> ExecMainStatus=0
> ExecStart={ path=/usr/sbin/watchdog ; argv[]=/usr/sbin/watchdog ; ignore_errors=no ; start_time=[Mon 2018-03-19 13:42:22 CET] ; stop_time=[Mon 2018-03-19 13:42:22 CET] ; pid=1267 ; code=exited ; status=0 }
> Slice=system.slice
> MemoryCurrent=18446744073709551615
> TasksCurrent=18446744073709551615
> Delegate=no
> CPUAccounting=no
> CPUShares=18446744073709551615
> StartupCPUShares=18446744073709551615
> CPUQuotaPerSecUSec=infinity
> BlockIOAccounting=no
> BlockIOWeight=18446744073709551615
> StartupBlockIOWeight=18446744073709551615
> MemoryAccounting=no
> MemoryLimit=18446744073709551615
> DevicePolicy=auto
> TasksAccounting=no
> TasksMax=18446744073709551615
> UMask=0022
> LimitCPU=18446744073709551615
> LimitFSIZE=18446744073709551615
> LimitDATA=18446744073709551615
> LimitSTACK=18446744073709551615
> LimitCORE=18446744073709551615
> LimitRSS=18446744073709551615
> LimitNOFILE=4096
> LimitAS=18446744073709551615
> LimitNPROC=63090
> LimitMEMLOCK=65536
> LimitLOCKS=18446744073709551615
> LimitSIGPENDING=63090
> LimitMSGQUEUE=819200
> LimitNICE=0
> LimitRTPRIO=0
> LimitRTTIME=18446744073709551615
> OOMScoreAdjust=0
> Nice=0
> IOScheduling=0
> CPUSchedulingPolicy=0
> CPUSchedulingPriority=0
> TimerSlackNSec=50000
> CPUSchedulingResetOnFork=no
> NonBlocking=no
> StandardInput=null
> StandardOutput=journal
> StandardError=inherit
> TTYReset=no
> TTYVHangup=no
> TTYVTDisallocate=no
> SyslogPriority=30
> SyslogLevelPrefix=yes
> SecureBits=0
> CapabilityBoundingSet=18446744073709551615
> AmbientCapabilities=0
> MountFlags=0
> PrivateTmp=no
> PrivateNetwork=no
> PrivateDevices=no
> ProtectHome=no
> ProtectSystem=no
> SameProcessGroup=no
> IgnoreSIGPIPE=yes
> NoNewPrivileges=no
> SystemCallErrorNumber=0
> RuntimeDirectoryMode=0755
> KillMode=control-group
> KillSignal=15
> SendSIGKILL=yes
> SendSIGHUP=no
> Id=watchdog.service
> Names=watchdog.service
> Requires=basic.target
> Wants=system.slice
> WantedBy=multi-user.target
> Conflicts=shutdown.target
> Before=multi-user.target shutdown.target
> After=basic.target systemd-journald.socket system.slice
> Description=watchdog daemon
> LoadState=loaded
> ActiveState=inactive
> SubState=dead
> FragmentPath=/usr/lib/systemd/system/watchdog.service
> DropInPaths=/etc/systemd/system/watchdog.service.d/override.conf
> UnitFileState=enabled
> UnitFilePreset=disabled
> InactiveExitTimestamp=Mon 2018-03-19 13:42:22 CET
> InactiveExitTimestampMonotonic=14539954
> ActiveEnterTimestamp=Mon 2018-03-19 13:42:22 CET
> ActiveEnterTimestampMonotonic=15052358
> ActiveExitTimestamp=Mon 2018-03-19 13:44:02 CET
> ActiveExitTimestampMonotonic=114543976
> InactiveEnterTimestamp=Mon 2018-03-19 13:44:07 CET
> InactiveEnterTimestampMonotonic=119544801
> CanStart=yes
> CanStop=yes
> CanReload=no
> CanIsolate=no
> StopWhenUnneeded=no
> RefuseManualStart=no
> RefuseManualStop=no
> AllowIsolate=no
> DefaultDependencies=yes
> OnFailureJobMode=replace
> IgnoreOnIsolate=yes
> IgnoreOnSnapshot=no
> NeedDaemonReload=no
> JobTimeoutUSec=0
> JobTimeoutAction=none
> ConditionResult=yes
> AssertResult=yes
> ConditionTimestamp=Mon 2018-03-19 13:42:22 CET
> ConditionTimestampMonotonic=14539719
> AssertTimestamp=Mon 2018-03-19 13:42:22 CET
> AssertTimestampMonotonic=14539719
> Transient=no
>
>
>
>
--
SMILE <http://www.smile.eu/>
20 rue des Jardins
92600 Asnières-sur-Seine
*Jérémy ROSEN*
Architecte technique
Responsable de l'expertise Smile-ECS
email jeremy.rosen at smile.fr <mailto:jeremy.rosen at smile.fr>
phone +33141402967
url http://www.smile.eu
Twitter <https://twitter.com/GroupeSmile> Facebook
<https://www.facebook.com/smileopensource> LinkedIn
<https://www.linkedin.com/company/smile> Github
<https://github.com/Smile-SA>
Découvrez l’univers Smile, rendez-vous sur smile.eu
<http://smile.eu/?utm_source=signature&utm_medium=email&utm_campaign=signature>
eco Pour la planète, n'imprimez ce mail que si c'est nécessaire
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20180320/52396873/attachment-0001.html>
More information about the systemd-devel
mailing list