单机游戏大全免费

游戏大全

当前位置:首页 > 互联网 IT业界 > Ubuntu中如何管理系统服务

Ubuntu中如何管理系统服务

admin 互联网 IT业界 41热度

在Ubuntu中,可以使用systemd来管理系统服务,下面是一些常用的管理服务的方法和示例:

(图片来源网络,侵删)

1、查看已安装的服务列表:

“`

systemctl listunits type=service

“`

2、启动一个服务:

“`

systemctl start service_name

“`

service_name是要启动的服务的名称。

3、停止一个服务:

“`

systemctl stop service_name

“`

4、重启一个服务:

“`

systemctl restart service_name

“`

5、设置开机自启一个服务:

“`

systemctl enable service_name

“`

这将使得该服务在系统启动时自动运行。

6、取消开机自启一个服务:

“`

systemctl disable service_name

“`

这将使得该服务在系统启动时不会自动运行。

7、查看服务的详细信息:

“`

systemctl status service_name

“`

这将显示有关服务的当前状态和其他详细信息。

8、设置服务为开机不自启:

“`

systemctl isenabled service_name

“`

如果输出为"disabled",则表示该服务未设置为开机自启。

9、设置服务的优先级:

“`

systemctl setproperty service_name "StartLimitIntervalSec=10" "StartLimitBurst=5" "RestartSec=10" "RestartUSec=1000000" "CPUQuota=50%" "MemoryLimit=infinity" "TasksMax=infinity" "OOMScoreAdjust=1000" "Nice=19" "RuntimeMaxSec=infinity" "TimeoutStopSec=infinity" "SendSIGKILL=no" "SendSIGHUP=yes" "WatchdogSec=0" "WatchdogTimestampMonotonic=yes" "WatchdogTimestampBoottime=yes" "WatchdogType=poweroff" "RestartPreventExitStatus=SIGINT SIGTERM" "RestartForceExitStatus=SIGINT SIGTERM SIGQUIT SIGILL SIGABRT SIGSEGV" "MaskedEvents=INT,TERM,QUIT,ILL,ABRT,SEGV,SYS" "UnitFileState=enabled" "AssertPath=/usr/local/bin/assert.sh" "AssertScript=/usr/local/bin/assert.sh %p" "AssertReloadSec=30" "AssertType=process" "AssertCategories=gui,network,io,console,filesystem,kernel,mail,authpriv,systemdlogind,user,timer,rtc,random,plymouth,bluetooth,rfkill,lightdm,x11,keyboard,touchpad,powerdev,mountall,automount,avahidaemon,colord,cups,dbusbroker,dmesg,gdm3,geoclue2,hibernate,iiosensorproxy,irqbalance,kexectools,libutempter,lmsensors,mdadm,microcode_checker,netcfg,nvidiapersistenced,openvpn,ostreecommitqueue,plymouthquitwaiting.service,pulseaudio,rcugpio,rcupowernowk8s.service,rcurtcgpio,restorecond,rtkitdaemon,rtkitplugtests,sandboxd,speechdispatcher,systemdaskpasswordwall.path,systemdbacklight@backlight:acpi_video0.service,systemdbootchart.service,systemdfsckd.service,systemdhostnamed.service,systemdjournald.service,systemdjournaldstatic.service,systemdlogind.service,systemdnetworkd.service,systemdnspawn.service,systemdrandomseed.service,systemdreadaheadcollect.service,systemdremountfs.service,systemdrfkill.service,systemdscreenlocker.service,systemdsessiond.service,systemdsetvtrgb.service,systemdshutdownd.service,systemdsockets.service,systemdsuspend.service,systemdtimesyncd.service,systemdudevd.service,systemdudevtrigger.service,systemdupdateutmp.service,systemdusersessions.service,systemduserdump.service,systemdvconsole.service" "Slice=" "CPUQuotaGroup=" "CPUQuotaGroupMembers=12%" "CPUQuotaPeriodUSec=1min" "CPUQuotaUser=root" "CPUShares=512" "TasksMax=infinity" "OOMScoreAdjust=1000" "Nice=19" "RuntimeMaxSec=infinity" "TimeoutStopSec=infinity" "SendSIGKILL=no" "SendSIGHUP=yes" "WatchdogSec=0" "WatchdogTimestampMonotonic=yes" "WatchdogTimestampBoottime=yes" "WatchdogType=poweroff" "RestartPreventExitStatus=SIGINT SIGTERM" "RestartForceExitStatus=SIGINT SIGTERM SIGQUIT SIGILL SIGABRT SIGSEGV" "MaskedEvents=INT,TERM,QUIT,ILL,ABRT,SEGV,SYS" "UnitFileState=enabled" "AssertPath=/usr/local/bin/assert.sh" "AssertScript=/usr/local/bin/assert.sh %p" "AssertReloadSec=30" "AssertType=process" "AssertCategories=gui network io console filesystem kernel mail authpriv systemdlogind user timer rtc random plymouth bluetooth rfkill lightdm x11 keyboard touchpad powerdev mountall automount avahidaemon colord cups dbusbroker dmesg gdm3 geoclue2 hibernate iiosensorproxy irqbalance kexectools libutempter lmsensors mdadm microcode_checker netcfg nvidiapersistenced openvpn ostreecommitqueue plymouthquitwaiting.service pulseaudio rcugpio rcupowernowk8s.service rcurtcgpio restorecond rtkkit daemon rtkkit plugtests sandboxd speech dispatcher systemd ask password wall path systemd backlight acpi video0 service systemd bootchart service systemd fsckd service systemd host name d service systemd journal d static service systemd login d service systemd network d service systemd nspawn service systemd random seed service systemd read ahead collect service systemd remount fs service systemd rfkill service systemd screen locker service systemd session d service systemd set vtrgb service systemd shutdown d service systemd sockets service systemded process with PID <PID> and UTS namespace <UTSNAME>."

更新时间 2024-05-20 15:12:43