python 自动拉起进程脚本
cat /usr/local/ssdb/moniter_ssdb.py #!/usr/bin/env python import os import sys import commands #ssdb port Precosslist = ('17000','17005','17010','17015','17020','17025','17030', '17035','17040','17045','17050','17055','17060','17065', '17070','17075','17080','17085','17090','17095') for port in Precosslist: acd = "ps -ef|grep friend_" + port + "|grep -v grep" (status,output) = commands.getstatusoutput(acd) if status == 256: ssdb_file1 = "rm /data/ssdb/friend_" + port + "/var/ssdb.pid -rf" ssdb_file2 = "cd /usr/local/ssdb;./ssdb-server -d /data/ssdb/friend_" + port + "/ssdb_friend_" + port + ".conf -s start" (status,output) = commands.getstatusoutput(ssdb_file1) (status,output) = commands.getstatusoutput(ssdb_file2)
贵有恒,何必三更起五更睡;最无益,只怕一日暴十寒