1.cd到/etc/init.d
创建一个uwsgi文件,修改权限 chmod 775 mongodb
2.编辑该文件
#!/bin/sh ### BEGIN INIT INFO # Provides: nginx # Required-Start: $local_fs $remote_fs $network $syslog $named # Required-Stop: $local_fs $remote_fs $network $syslog $named # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: starts the nginx web server # Description: starts nginx using start-stop-daemon ### END INIT INFO UWSGI_INI="/etc/uwsgi/uwsgi.ini" startuwsgi(){ uwsgi --ini ${UWSGI_INI} } stopuwsgi(){ PIDFILE=`cat ${UWSGI_INI} |grep pidfile|cut -d '=' -f 2` kill -9 `cat ${PIDFILE}` rm -f ${PIDFILE} } case "$1" in start) startuwsgi ;; stop) stopuwsgi ;; restart) stopuwsgi startuwsgi ;; *) echo "uwsgi: $NAME {start|stop|restart}">&2 exit 3 esac
3.加入到系统启动中
// 添加到系统启动 update-rc.d uwsgi defaults // 从系统启动中删除 update-rc.d uwsgi remove
4.输入上面启动命令
service uwsgi restart