linux 自启动 ,让生活更美好!!

systemctl enable svnserve.service  

systemctl enable iptables.service

systemctl enable firewalld.service

nginx 人工亲测,好使

#Author:Alex.Wang

#!/usr/bin/env python
# -*- coding:utf-8 -*-
 
import  sys 
import  os 
from  sys  import     argv
 
DAEMON = '/usr/local/nginx/sbin/nginx'
CONFIGFILE = '/usr/local/nginx/conf/nginx.conf'
PIDFILE = '/usr/local/nginx/logs/nginx.pid'
 
 
NGSTART = '%s -c %s'  %  (DAEMON,CONFIGFILE)
NGSTOP = 'kill -QUIT `cat %s`'  %   PIDFILE
 
def  n_start():
     if  os.path.isfile(PIDFILE):
         print  "nginx is already running!"
     else :
         if   os.system(NGSTART)  = =  0
             print  "nginx start is ok!" 
 
def  n_stop():
     if  os.path.isfile(PIDFILE):
         if  os.system(NGSTOP)  = =  0 :
             print  "nginx stop is ok!"
     else :
         print  "nginx is not running!"
 
def  n_restart():
     stop()
     start()
 
if  argv  = =  "-h"  or  argv  = =  "--help"  or  len (argv) = = 1 :
 
     print  "Usage: %s {start|stop|restart|reload}"   %  argv[ 0 ]
elif  argv[ 1 = =  'start' :
     n_start() 
elif  argv[ 1 = =  'stop' :
     n_stop()
elif  argv[ 1 = =  'restart' :
     n_stop()
     n_start()
 
else
         print  "Usage: %s {start|stop|restart|reload}"   %  argv[ 0 ]

 

转载于:https://www.cnblogs.com/alex-note/p/7064674.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值