折腾:
【已解决】CentOS中如何用systemctl管理supervisor包括设置supervisor开机启动
搜到了:
How To Use Systemctl to Manage Systemd Services and Units | DigitalOcean
之前是已经知道了基本用法:
<code>systemctl status xxx systemctl start xxx systemctl stop xxx systemctl restart xxx systemctl reload xxx systemctl enable xxx systemctl disable xxx systemctl is-enabled xxx systemctl is-active xxx </code>
但是更高级的,不知道,所以继续去学习学习,和systemctl有关的东西:
systemctl cat
<code>[root@xx-general-01 robotDemo]# systemctl cat supervisord # /usr/lib/systemd/system/supervisord.service [Unit] Description=Process Monitoring and Control Daemon After=rc-local.service nss-user-lookup.target [Service] Type=forking ExecStart=/usr/bin/supervisord -c /etc/supervisord.conf [Install] WantedBy=multi-user.target [root@xx-general-01 robotDemo]# ll /usr/lib/systemd/system/supervisord.service -rw-r--r-- 1 root root 221 Jul 29 2017 /usr/lib/systemd/system/supervisord.service </code>
看看list-dependencies:
<code>[root@xx-general-01 robotDemo]# systemctl list-dependencies supervisord supervisord.service ● ├─system.slice ● └─basic.target ● ├─microcode.service ● ├─rhel-autorelabel-mark.service ● ├─rhel-autorelabel.service ● ├─rhel-configure.service ● ├─rhel-dmesg.service ● ├─rhel-loadmodules.service ● ├─[email protected] ● ├─paths.target ● ├─slices.target ● │ ├─-.slice ● │ └─system.slice ● ├─sockets.target ● │ ├─dbus.socket ● │ ├─systemd-initctl.socket ● │ ├─systemd-journald.socket ● │ ├─systemd-shutdownd.socket ● │ ├─systemd-udevd-control.socket ● │ └─systemd-udevd-kernel.socket ● ├─sysinit.target ● │ ├─dev-hugepages.mount ● │ ├─dev-mqueue.mount ● │ ├─kmod-static-nodes.service ● │ ├─plymouth-read-write.service ● │ ├─plymouth-start.service ● │ ├─proc-sys-fs-binfmt_misc.automount ● │ ├─sys-fs-fuse-connections.mount ● │ ├─sys-kernel-config.mount ● │ ├─sys-kernel-debug.mount ● │ ├─systemd-ask-password-console.path ● │ ├─systemd-binfmt.service ● │ ├─systemd-firstboot.service ● │ ├─systemd-hwdb-update.service ● │ ├─systemd-journal-catalog-update.service ● │ ├─systemd-journal-flush.service ● │ ├─systemd-journald.service ● │ ├─systemd-machine-id-commit.service ● │ ├─systemd-modules-load.service ● │ ├─systemd-random-seed.service ● │ ├─systemd-sysctl.service ● │ ├─systemd-tmpfiles-setup-dev.service ● │ ├─systemd-tmpfiles-setup.service ● │ ├─systemd-udev-trigger.service ● │ ├─systemd-udevd.service ● │ ├─systemd-update-done.service ● │ ├─systemd-update-utmp.service ● │ ├─systemd-vconsole-setup.service ● │ ├─cryptsetup.target ● │ ├─local-fs.target ● │ │ ├─-.mount ● │ │ ├─rhel-import-state.service ● │ │ ├─rhel-readonly.service ● │ │ ├─systemd-fsck-root.service ● │ │ └─systemd-remount-fs.service ● │ └─swap.target ● └─timers.target ● └─systemd-tmpfiles-clean.timer [root@xx-general-01 robotDemo]# </code>
再去看看show:
<code>[root@xx-general-01 robotDemo]# systemctl show supervisord 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=exit-code ExecMainStartTimestamp=Mon 2018-05-14 16:41:52 CST ExecMainStartTimestampMonotonic=5390982 ExecMainExitTimestamp=Thu 2018-05-24 12:00:24 CST ExecMainExitTimestampMonotonic=847117137605 ExecMainPID=678 ExecMainCode=1 ExecMainStatus=2 ExecStart={ path=/usr/bin/supervisord ; argv[]=/usr/bin/supervisord -c /etc/supervisord.conf ; ignore_errors=no ; start_time=[Thu 2018-05-24 13:57:01 CST] ; stop_time=[Thu 2018-05-24 13: 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=63471 LimitMEMLOCK=65536 LimitLOCKS=18446744073709551615 LimitSIGPENDING=63471 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=supervisord.service Names=supervisord.service Requires=basic.target Wants=system.slice WantedBy=multi-user.target Conflicts=shutdown.target Before=shutdown.target multi-user.target After=nss-user-lookup.target system.slice rc-local.service systemd-journald.socket basic.target Description=Process Monitoring and Control Daemon LoadState=loaded ActiveState=failed SubState=failed FragmentPath=/usr/lib/systemd/system/supervisord.service UnitFileState=enabled UnitFilePreset=disabled InactiveExitTimestamp=Thu 2018-05-24 13:57:01 CST InactiveExitTimestampMonotonic=854114362107 ActiveEnterTimestamp=Mon 2018-05-14 16:41:52 CST ActiveEnterTimestampMonotonic=5391055 ActiveExitTimestamp=Thu 2018-05-24 12:00:24 CST ActiveExitTimestampMonotonic=847117138092 InactiveEnterTimestamp=Thu 2018-05-24 13:57:02 CST InactiveEnterTimestampMonotonic=854114560838 CanStart=yes CanStop=yes CanReload=no CanIsolate=no StopWhenUnneeded=no RefuseManualStart=no RefuseManualStop=no AllowIsolate=no DefaultDependencies=yes OnFailureJobMode=replace IgnoreOnIsolate=no IgnoreOnSnapshot=no NeedDaemonReload=no JobTimeoutUSec=0 JobTimeoutAction=none ConditionResult=yes AssertResult=yes ConditionTimestamp=Thu 2018-05-24 13:57:01 CST ConditionTimestampMonotonic=854114361339 AssertTimestamp=Thu 2018-05-24 13:57:01 CST AssertTimestampMonotonic=854114361340 Transient=no </code>
有机会,去试试:
mask
unmask
和systemctl相关的:
systemctl
daemons进程:systemd
管理系统的进程和服务
journalctl
daemons进程:journald
管理日志log management
loginctl
daemons进程:logind
管理用户会话user sessions
转载请注明:在路上 » 【整理】systemctl的使用心得和语法