나는 오래 전에 "동적" 서비스 유닛을 작성했습니다. 그런 다음 또는 와 같은 단위의 변형을 활성화했습니다./etc/systemd/system/[email protected]
[email protected]
[email protected]
그런 다음 내가 활성화한 것을 잊어버렸습니다.
@.service
항목에서 파생된 단위를 나열하는 방법은 무엇입니까 ?
나는 그들이 존재한다는 것을 안다. 왜냐하면
- 내 시스템에서 실행되는 것으로 보이는 서비스를 시작합니다.
- 내가 기억하는 사람 중 실행하면
systemctl show myunit@hello
올바른 정보가 출력됩니다.
나는 그것들을 나열할 것이라고 생각했거나 systemctl
나열 하려고 systemctl list-units --type service --all
했지만 systemctl list-unit-files | grep enabled
그렇지 않았습니다. [email protected]
출력에는 표시되지 않습니다(정확한 정보가 제공되었음에도 불구하고 ) show
.
단위는 "일회성" 단위입니다. 명령이 ExecStart
해당 작업을 수행하고 종료됩니다. (이제 장치 유형이 설정되지 않았음을 깨달았습니다. 그러나 작동하므로 기본값은 정상입니다.)
이 명령의 출력은 show
동적 정의와 거의 일치합니다.
/etc/systemd/system # systemctl show docker-compose@domotique root@srv
Type=simple
Restart=no
NotifyAccess=none
RestartUSec=100ms
TimeoutStartUSec=5s
TimeoutStopUSec=5s
RuntimeMaxUSec=infinity
WatchdogUSec=0
WatchdogTimestampMonotonic=0
PermissionsStartOnly=no
RootDirectoryStartOnly=no
RemainAfterExit=no
GuessMainPID=yes
MainPID=0
ControlPID=0
FileDescriptorStoreMax=0
NFileDescriptorStore=0
StatusErrno=0
Result=success
UID=[not set]
GID=[not set]
NRestarts=0
ExecMainStartTimestampMonotonic=0
ExecMainExitTimestampMonotonic=0
ExecMainPID=0
ExecMainCode=0
ExecMainStatus=0
ExecStartPre={ path=/usr/local/bin/docker-compose ; argv[]=/usr/local/bin/docker-compose -f /etc/docker/docker-compose-domotique.yaml pull --ignore-pull-failures ; ignore_errors=
ExecStart={ path=/usr/local/bin/docker-compose ; argv[]=/usr/local/bin/docker-compose -f /etc/docker/docker-compose-domotique.yaml up -d ; ignore_errors=no ; start_time=[n/a] ; s
Slice=system-docker\x2dcompose.slice
MemoryCurrent=[not set]
CPUUsageNSec=[not set]
TasksCurrent=[not set]
IPIngressBytes=18446744073709551615
IPIngressPackets=18446744073709551615
IPEgressBytes=18446744073709551615
IPEgressPackets=18446744073709551615
Delegate=no
CPUAccounting=no
CPUWeight=[not set]
StartupCPUWeight=[not set]
CPUShares=[not set]
StartupCPUShares=[not set]
CPUQuotaPerSecUSec=infinity
IOAccounting=no
IOWeight=[not set]
StartupIOWeight=[not set]
BlockIOAccounting=no
BlockIOWeight=[not set]
StartupBlockIOWeight=[not set]
MemoryAccounting=no
MemoryLow=0
MemoryHigh=infinity
MemoryMax=infinity
MemorySwapMax=infinity
MemoryLimit=infinity
DevicePolicy=auto
TasksAccounting=yes
TasksMax=4915
IPAccounting=no
UMask=0022
LimitCPU=infinity
LimitCPUSoft=infinity
LimitFSIZE=infinity
LimitFSIZESoft=infinity
LimitDATA=infinity
LimitDATASoft=infinity
LimitSTACK=infinity
LimitSTACKSoft=8388608
LimitCORE=infinity
LimitCORESoft=0
LimitRSS=infinity
LimitRSSSoft=infinity
LimitNOFILE=4096
LimitNOFILESoft=1024
LimitAS=infinity
LimitASSoft=infinity
LimitNPROC=31230
LimitNPROCSoft=31230
LimitMEMLOCK=16777216
LimitMEMLOCKSoft=16777216
LimitLOCKS=infinity
LimitLOCKSSoft=infinity
LimitSIGPENDING=31230
LimitSIGPENDINGSoft=31230
LimitMSGQUEUE=819200
LimitMSGQUEUESoft=819200
LimitNICE=0
LimitNICESoft=0
LimitRTPRIO=0
LimitRTPRIOSoft=0
LimitRTTIME=infinity
LimitRTTIMESoft=infinity
WorkingDirectory=/etc/docker
OOMScoreAdjust=0
Nice=0
IOSchedulingClass=0
IOSchedulingPriority=0
CPUSchedulingPolicy=0
CPUSchedulingPriority=0
TimerSlackNSec=50000
CPUSchedulingResetOnFork=no
NonBlocking=no
StandardInput=null
StandardInputData=
StandardOutput=journal
StandardError=inherit
TTYReset=no
TTYVHangup=no
TTYVTDisallocate=no
SyslogPriority=30
SyslogLevelPrefix=yes
SyslogLevel=6
SyslogFacility=3
LogLevelMax=-1
SecureBits=0
CapabilityBoundingSet=cap_chown cap_dac_override cap_dac_read_search cap_fowner cap_fsetid cap_kill cap_setgid cap_setuid cap_setpcap cap_linux_immutable cap_net_bind_service cap
AmbientCapabilities=
DynamicUser=no
RemoveIPC=no
MountFlags=
PrivateTmp=no
PrivateDevices=no
ProtectKernelTunables=no
ProtectKernelModules=no
ProtectControlGroups=no
PrivateNetwork=no
PrivateUsers=no
ProtectHome=no
ProtectSystem=no
SameProcessGroup=no
UtmpMode=init
IgnoreSIGPIPE=yes
NoNewPrivileges=no
SystemCallErrorNumber=0
LockPersonality=no
RuntimeDirectoryPreserve=no
RuntimeDirectoryMode=0755
StateDirectoryMode=0755
CacheDirectoryMode=0755
LogsDirectoryMode=0755
ConfigurationDirectoryMode=0755
MemoryDenyWriteExecute=no
RestrictRealtime=no
RestrictNamespaces=no
MountAPIVFS=no
KeyringMode=private
KillMode=control-group
KillSignal=15
SendSIGKILL=yes
SendSIGHUP=no
[email protected]
[email protected]
Requires=sysinit.target docker.service system-docker\x2dcompose.slice -.mount
Conflicts=shutdown.target
Before=shutdown.target
After=basic.target network.target system-docker\x2dcompose.slice sysinit.target -.mount systemd-journald.socket
RequiresMountsFor=/etc/docker
Description=docker compose startup for domotique
LoadState=loaded
ActiveState=inactive
SubState=dead
FragmentPath=/etc/systemd/system/[email protected]
UnitFileState=disabled
UnitFilePreset=enabled
StateChangeTimestampMonotonic=0
InactiveExitTimestampMonotonic=0
ActiveEnterTimestampMonotonic=0
ActiveExitTimestampMonotonic=0
InactiveEnterTimestampMonotonic=0
CanStart=yes
CanStop=yes
CanReload=no
CanIsolate=no
StopWhenUnneeded=no
RefuseManualStart=no
RefuseManualStop=no
AllowIsolate=no
DefaultDependencies=yes
OnFailureJobMode=replace
IgnoreOnIsolate=no
NeedDaemonReload=no
JobTimeoutUSec=infinity
JobRunningTimeoutUSec=infinity
JobTimeoutAction=none
ConditionResult=no
AssertResult=no
ConditionTimestampMonotonic=0
AssertTimestampMonotonic=0
Transient=no
Perpetual=no
StartLimitIntervalUSec=10s
StartLimitBurst=5
StartLimitAction=none
FailureAction=none
SuccessAction=none
CollectMode=inactive
/etc/systemd/system # cat /etc/systemd/system/[email protected] root@srv
[Unit]
Description=docker compose startup for %i
After=network.target
Requires=docker.service
[Service]
ExecStartPre=-/usr/local/bin/docker-compose -f /etc/docker/docker-compose-%i.yaml pull --ignore-pull-failures
ExecStart=/usr/local/bin/docker-compose -f /etc/docker/docker-compose-%i.yaml up -d
WorkingDirectory=/etc/docker
[Install]
WantedBy=multi-user.target
답변1
나는 systemctl status myunit@*.service
예를 들어 제안합니다. 의 "전역 모드"를 참조하십시오 man systemctl
.
표준 쉘을 사용하고 있고 myunit@*.service
일치하는 파일이 현재 디렉토리에 존재할 수 있는 경우 다음이 필요할 수 있습니다.탈출하다*
대신 메타 문자를 사용합니다 \*
. 항상 이렇게 하면 문제가 되지 않지만 약간의 추가 입력이 추가됩니다.