httpd -k restart :打印一些信息,如“service httpd restart”
httpd -k restart : print some info like " service httpd restart "
通过服务命令重新启动 apache :
service httpd restart
Stopping httpd: [ OK ]
Starting httpd: [ OK ]
我希望能够在不使用 "service" 命令的情况下获得相同的输出。
以下命令有效但不打印任何内容。
/usr/sbin/httpd -k restart
"service" 命令运行 /etc/init.d/httpd
脚本,该脚本重新启动 httpd 并打印信息。
使用 /usr/sbin/httpd -k restart
,您将在不打印任何内容的情况下重新启动 httpd。
I want to be able to get the same output without using the "service" command.
选项 1
运行 httpd 初始化脚本:
/etc/init.d/httpd restart
选项 2
您可以创建如下脚本:
#!/bin/bash
echo "Restarting httpd..."
/usr/sbin/httpd -k restart
例如,将其命名为“restart_httpd.sh
”,并使其可执行:
chmod +x restart_httpd.sh
运行它:
./restart_httpd.sh
通过服务命令重新启动 apache :
service httpd restart
Stopping httpd: [ OK ]
Starting httpd: [ OK ]
我希望能够在不使用 "service" 命令的情况下获得相同的输出。
以下命令有效但不打印任何内容。
/usr/sbin/httpd -k restart
"service" 命令运行 /etc/init.d/httpd
脚本,该脚本重新启动 httpd 并打印信息。
使用 /usr/sbin/httpd -k restart
,您将在不打印任何内容的情况下重新启动 httpd。
I want to be able to get the same output without using the "service" command.
选项 1
运行 httpd 初始化脚本:
/etc/init.d/httpd restart
选项 2
您可以创建如下脚本:
#!/bin/bash
echo "Restarting httpd..."
/usr/sbin/httpd -k restart
例如,将其命名为“restart_httpd.sh
”,并使其可执行:
chmod +x restart_httpd.sh
运行它:
./restart_httpd.sh