标签:
pycharm 配置了提交服务器项目每次pycharm修改后,虽然保存到服务器但是项目还得自己去服务器kill再启动。就花几分钟写了shell脚本用于监控项目目录变化并重启tornado项目的脚本
如果技术不懂需要请联系我
[liujianzuo@zl scripts]$ cat realtime_rsync.sh #!/bin/bash #para host01=10.0.0.253 #src=/backup src="/home/liujianzuo/htdocs/tornado/my_tornado_blog/my_tornado_blog" dst=backup user=rsync_backup rsync_passfile=/etc/rsync.password inotify_home=/usr/local/inotify/ ${inotify_home}/bin/inotifywait -mrq --timefmt ‘%d/%m/%y %H:%M‘ --format ‘%T %w%f‘ -e close_write,delete,create,attrib $src | while read file do /bin/sh /server/scripts/manage.sh done [liujianzuo@zl scripts]$ cat manage.sh #!/bin/bash #by liujianzuo # date:20160801 pid=`ps -ef |grep App.py|grep -v grep|awk ‘{print $2}‘` n=`echo $pid|wc -m` echo $pid echo $n if [ $n -lt 2 ];then cd /home/liujianzuo/htdocs/tornado/my_tornado_blog/my_tornado_blog nohup python3 App.py & else ps -ef |grep App.py|grep -v grep|awk ‘{print $2}‘|xargs kill ps -ef |grep App.py|grep -v grep|awk ‘{print $2}‘|xargs kill fi
标签:
原文地址:http://www.cnblogs.com/liujianzuo888/p/5841777.html