美文网首页
uos 服务与计划任务

uos 服务与计划任务

作者: 小桥流水啦啦啦 | 来源:发表于2020-07-06 14:08 被阅读0次
1、实验-systemctl控制服务

apt-get -y install apache2
systemctl status apache2

● apache2.service - The Apache HTTP Server
   Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
   Active: active (running) since Mon 2020-07-06 14:02:01 CST; 14s ago
 Main PID: 15771 (apache2)
    Tasks: 55 (limit: 4915)
   CGroup: /system.slice/apache2.service
           ├─15771 /usr/sbin/apache2 -k start
           ├─15772 /usr/sbin/apache2 -k start
           └─15773 /usr/sbin/apache2 -k start

7月 06 14:02:01 imhqq-PC systemd[1]: Starting The Apache HTTP Server...
7月 06 14:02:01 imhqq-PC apachectl[15760]: AH00558: apache2: Could not reliably determine the server'
7月 06 14:02:01 imhqq-PC systemd[1]: Started The Apache HTTP Server.

systemctl start apache2
systemctl stop apache2
systemctl restart apache2
systemctl reload apache2
systemctl enable apache2

Synchronizing state of apache2.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable apache2

systemctl disable apache2

Synchronizing state of apache2.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install disable apache2
insserv: warning: current start runlevel(s) (empty) of script `apache2' overrides LSB defaults (2 3 4 5).
insserv: warning: current stop runlevel(s) (0 1 2 3 4 5 6) of script `apache2' overrides LSB defaults (0 1 6).

systemctl mask apache2

Synchronizing state of apache2.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install disable apache2
insserv: warning: current start runlevel(s) (empty) of script `apache2' overrides LSB defaults (2 3 4 5).
insserv: warning: current stop runlevel(s) (0 1 2 3 4 5 6) of script `apache2' overrides LSB defaults (0 1 6).

systemctl unmask apache2

Removed /etc/systemd/system/apache2.service.

update-rc.d apache2 enable 2 3 4 5

2、实验-systemctl控制启动级别

systemctl get-default

graphical.target

systemctl set-default multi-user.target

Created symlink /etc/systemd/system/default.target → /lib/systemd/system/multi-user.target.

reboot
systemctl isolate graphical.target
systemctl list-unit-files --type target | grep runleve

runlevel0.target          disabled
runlevel1.target          disabled
runlevel2.target          enabled 
runlevel3.target          enabled 
runlevel4.target          enabled 
runlevel5.target          static  
runlevel6.target          disabled

systemctl isolate runlevel5.target

相关文章

网友评论

      本文标题:uos 服务与计划任务

      本文链接:https://www.haomeiwen.com/subject/ogvwqktx.html