I would to find if the output of 'ps' command contain the process 'smtpd' The problem is that various busybox need different ps command! some need ' ps x ', other need ' ps w ' and other only the ' ps '
How i can make a universal algorithm that try all 'ps' possibilities ?
Example:
linex=''
foo=os.popen('ps')
for x in foo.readlines():
if x.lower().find('smtpd') != -1:
// SOME SCRIPT STUFF on linex string...
return linex
linex=''
foo=os.popen('ps w')
for x in foo.readlines():
if x.lower().find('smtpd') != -1:
// SOME SCRIPT STUFF on linex string...
return linex
linex=''
foo=os.popen('ps x')
for x in foo.readlines():
if x.lower().find('smtpd') != -1:
// SOME SCRIPT STUFF on linex string...
return linex
psshouldn't be truncating lines unless writing to a TTY. Also, I can't believe different busybox versions have radically different versions ofps(are you sure you don't have a real separatepscommand on some machines instead of a busybox builtin?) Plus, if you use the standard (--prefixed) flags instead of trying to use the GNU or BSD extensions,ps -wwshould work on anyps—GNU, BSD, or otherwise.