
2、查实例grep Stop service
auditdservice:RefuseManualStop=yes
blk-availabilityservice:ExecStop=/usr/sbin/blkdeactivate -u -l wholevg
console-shellservice:ExecStopPost=-/usr/bin/systemctl poweroff
cpupowerservice:ExecStop=/usr/bin/cpupower $CPUPOWER_STOP_OPTS
ebtablesservice:ExecStop=/usr/libexec/ebtables stop
iptablesservice:ExecStop=/usr/libexec/iptables/iptablesinit stop
kdumpservice:ExecStop=/usr/bin/kdumpctl stop
nginxservice:ExecStop=/bin/kill -s QUIT $MAINPID
postfixservice:ExecStop=/usr/sbin/postfix stop
rdmaservice:RefuseManualStop=true
rhel-configureservice:ExecStopPost=/bin/rm -f /unconfigured
3、可见并不是所有的stop都是kill命令这个是属于服务器方法,可以了解一下supervisor,将需要自启动的程序加入到supervisor的启动配置,只要supervisor不停止,那么监控进程就会一直运行,并且如果出现关闭情况也会被立即重启。
Linux的发行版本不同,重启服务的方式也是不一样的。
centos 6版本:
service 服务名 restart
例如重启vsftpd:
[root@linuxprobe ~]# service vsftpd restart
注意:service 服务器 start/stop/status/restart/reload
这里需要确定下restart 和reload 的区别,restart是重启,也就是kill掉进程,然后在启动进程,而reload是重新加载配置。
centos7x版本:
systemctl restart 服务名
例如重启vsftpd:
[root@linuxprobe ~]# systemctl restart vsftpd
另外,如果服务是编译安装的话,重启的命令就是要看安装包的说明了,例如nginx:
[root@linuxprobe ~]# cd /xxx/xx/xx/sbin
[root@linuxprobe ~]# /nginx -s reload
当然也可以手动些shell重启脚本,一般情况下都是如果重启服务,又没有脚本,比如tomcat,我们一般都是先杀进程 ,然后启服务:
[root@linuxprobe ~]#ps -ef |grep tomcat |grep -v tomcat |awk '{print$2}' |xargs kill -9 && sh /xx/xx/xx/startshsh
更多Linux的知识建议更加系统 的去学习去联系,可以参考《Linux就该这样学》,加油吧!!!
linux服务器注销界面会终止程序如下这时候我们可以使用后台守护线程来解决这个问题。
nohupjava-jarwordjar&nohup:不挂断的运行。即使你挂断了ssh连接,程序照样运行。
&:在后台运行。按ctrl+c后推出程序运行界面,程序会在后台运行。
这样线程就启动了。
我们输入命令查看下进程是否在运行
ps-ef|grepjavaps:将程序某个时间的运行状况截取下来
grep:查找命令
此处已成功运行。大功告成
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)