【发布时间】:2016-04-02 05:35:01
【问题描述】:
我正在编写一个 shell 脚本,这里是 sn-p ..
sudo service httpd restart --- ( 1)
if [ $? -eq 0 ]; then
# Now configure php.ini using sed command
sudo sed -i 's_;date.timezone =_date.timezone = "Asia/Kolkata"_' /etc/php.ini
# Now restart the httpd server again
sudo service httpd restart ---- This statement throws error
当我在上面运行脚本时,我在第二个 sudo service httpd restart 语句处收到错误 Address already in use: make_sock: could not bind to address。
我怀疑这是因为当第一次运行 sudo service httpd restart 时,在它完成完全第二次“sudo service httpd restart”运行之前。
那么我怎样才能确定地测试如果第一个sudo service httpd restart 完成,那么只有其余的代码会执行。
我希望我可以理解..
谢谢
【问题讨论】:
标签: linux apache shell unix sh