stopping swift services using python script

import sys
import shutil
import os
import subprocess, signal 

    format : python stop_service {proxy|object}
    List the process and find server pid to kill
service = 'swift-'+sys.argv[1]+'-server'
print service
proc_list = subprocess.Popen(['ps','-ef'],stdout = subprocess.PIPE)
out,err = proc_list.communicate()
for line in out.splitlines():
    #print line
    if (service in line):
        pid = int (line.split(None,2)[1])

print 'please run the {} service  manually'.format(service)

ট্যাগসমূহ:, , , , , ,

মন্তব্য করুন

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  পরিবর্তন )

Google+ photo

You are commenting using your Google+ account. Log Out /  পরিবর্তন )

Twitter picture

You are commenting using your Twitter account. Log Out /  পরিবর্তন )

Facebook photo

You are commenting using your Facebook account. Log Out /  পরিবর্তন )


Connecting to %s

%d bloggers like this: