简体   繁体   中英

Fabric problems with reloading supervisor on remote host

My project is hosted on Webfaction and supervisor is used to be aware of processes. I use shell utils to get the PID of supervisor and it works just fine when I do it manually, but I got random PIDs when executing the same command remotely with Fabric

Code to get PID of supervisor

spid = run('ps auxw | grep supervisord | grep %s | tr -s \' \' | cut -d\  -f 2' % USER)

if spid:                   # if supervisor is running and PID is found
    run('kill %s' % spid)  # kill supervidor daemon

I'm confused why I get random PIDs when calling command remotely, what is wrong with the way I do it?

Thanks,

Sultan

You could solve this simpler by using pkill or pgrep to find the pid. But also if that's all you're doing I'd say use the -j|--pidfile= option so you don't have to look it up through the process output.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM