一, nginx
1,停止
从容关闭nginx
sudo kill -QUIT Nginx主进程id
快速停止
sudo kill -TERM nginx主进程id
强制停止
sudo pkill -9 nginx
2,启动
sudo /usr/sbin/nginx -c /etc/nginx/nginx.conf
3,检查,重启
sudo /usr/sbin/nginx -t -c /etc/nginx/nginx.conf
sudo kill -HUP `ps -ef |grep nginx|grep master|awk '{print $2}'`
4. 其他
二,squid
1,停止
sudo /usr/local/squid3/sbin/squid -k shutdown
或者
sudo kill -TERM squid
2,启动
sudo /usr/local/squid3/sbin/squid -s
3,重启
sudo /usr/local/squid3/sbin/squid -k reconfigure
--------------------------------------------
#!/bin/sh
# restart squid.
sq="`ps aux |grep 'squid' |grep -v 'grep'|awk '{print $2}'`"
for pid in ${sq}
do
sudo kill -9 ${pid}
done
sleep 2
sudo /usr/local/squid3/sbin/squid -s