page counter next up previous contents
Next: 開機自動啟動服務 Up: systemctl 系統服務控制 Previous: systemctl 命令   Contents

服務啟動

  1. 查看服務 postfix 狀態,目前為 active,正在執行中。
    [root@kvm7 ~]# systemctl status postfix.service 
    postfix.service - Postfix Mail Transport Agent
       Loaded: loaded (/usr/lib/systemd/system/postfix.service; enabled)
       Active: active (running) since Fri 2014-08-15 21:05:20 CST; 1min 6s ago
      Process: 2691 ExecStop=/usr/sbin/postfix stop (code=exited, status=0/SUCCESS)
      Process: 2705 ExecStart=/usr/sbin/postfix start (code=exited, status=0/SUCCESS)
      Process: 2703 ExecStartPre=/usr/libexec/postfix/chroot-update (code=exited, status=0/SUCCESS)
      Process: 2700 ExecStartPre=/usr/libexec/postfix/aliasesdb (code=exited, status=0/SUCCESS)
     Main PID: 2777 (master)
       CGroup: /system.slice/postfix.service
               ├─2777 /usr/libexec/postfix/master -w
               ├─2778 pickup -l -t unix -u
               └─2779 qmgr -l -t unix -u
    
    Aug 15 21:05:20 kvm7.deyu.wang systemd[1]: Starting Postfix Mail Transport A....
    Aug 15 21:05:20 kvm7.deyu.wang postfix/master[2777]: daemon started -- versio...
    Aug 15 21:05:20 kvm7.deyu.wang systemd[1]: Started Postfix Mail Transport Agent.
    Hint: Some lines were ellipsized, use -l to show in full.
    
  2. 關閉服務 postfix。
    [root@kvm7 ~]# systemctl stop postfix.service
    
  3. 查看服務 postfix 狀態,目前為 inactive,關閉中。
    [root@kvm7 ~]# systemctl status postfix.service 
    postfix.service - Postfix Mail Transport Agent
       Loaded: loaded (/usr/lib/systemd/system/postfix.service; enabled)
       Active: inactive (dead) since Fri 2014-08-15 21:04:09 CST; 10s ago
      Process: 2585 ExecStop=/usr/sbin/postfix stop (code=exited, status=0/SUCCESS)
      Process: 1491 ExecStart=/usr/sbin/postfix start (code=exited, status=0/SUCCESS)
      Process: 1486 ExecStartPre=/usr/libexec/postfix/chroot-update (code=exited, status=0/SUCCESS)
      Process: 1235 ExecStartPre=/usr/libexec/postfix/aliasesdb (code=exited, status=0/SUCCESS)
     Main PID: 2134 (code=killed, signal=TERM)
    
    Aug 15 17:51:48 kvm7.deyu.wang systemd[1]: Starting Postfix Mail Transport A....
    Aug 15 17:51:50 kvm7.deyu.wang postfix/master[2134]: daemon started -- versio...
    Aug 15 17:51:50 kvm7.deyu.wang systemd[1]: Started Postfix Mail Transport Agent.
    Aug 15 21:04:09 kvm7.deyu.wang systemd[1]: Stopping Postfix Mail Transport A....
    Aug 15 21:04:09 kvm7.deyu.wang systemd[1]: Stopped Postfix Mail Transport Agent.
    Hint: Some lines were ellipsized, use -l to show in full.
    
  4. 查看服務 postfix 目前是否啟動?結果為 inactive。
    [root@kvm7 ~]# systemctl is-active postfix.service 
    inactive
    
  5. 啟動服務 postfix。
    [root@kvm7 ~]# systemctl start postfix.service
    
  6. 再查看服務 postfix 目前是否啟動?結果為 active。
    [root@kvm7 ~]# systemctl is-active postfix.service 
    active
    
  7. 也可以用 restart 選項,重新啟動服務 postfix。
    [root@kvm7 ~]# systemctl restart postfix.service
    
  8. 再查看服務 postfix 目前是否啟動?結果為 active。
    [root@kvm7 ~]# systemctl is-active postfix.service 
    active
    



2015-12-04