代码之家  ›  专栏  ›  技术社区  ›  user8285353

httpd-k restart:打印一些信息,如“service httpd restart”

  •  0
  • user8285353  · 技术社区  · 7 年前

    通过服务命令重新启动apache:

    service httpd restart
    
    Stopping httpd: [ OK ] 
    Starting httpd: [ OK ] 
    

    /usr/sbin/httpd -k restart
    
    1 回复  |  直到 7 年前
        1
  •  1
  •   sergej    7 年前

    /etc/init.d/httpd 脚本,该脚本重新启动httpd并打印信息。

    具有 /usr/sbin/httpd -k restart ,您正在重新启动httpd,而不打印任何内容。

    选项1

    /etc/init.d/httpd restart
    

    您可以创建如下脚本:

    #!/bin/bash
    echo "Restarting httpd..."
    /usr/sbin/httpd -k restart
    

    命名为' restart_httpd.sh

    chmod +x restart_httpd.sh
    

    运行它:

    ./restart_httpd.sh