how many users?
Kenneth Brody
kenbrody at spamcop.net
Fri Dec 6 09:09:40 PST 2013
On 12/5/2013 9:23 PM, Fairlight wrote:
> On Thu, Dec 05, 2013 at 11:29:54AM -0500, Kenneth Brody thus spoke:
>>
>> But, if dclerk system's out to dreport, you'll see two entries.
>> (Actually, you'll probably see 3, including the original runmenu.)
>
> Yes, and if you're running <= 5.6, my approach is still correct, since
> system()ing off clerk and report ate another licence prior to that version.
> Most of my clients are still on <= 5.0.14.
Given that 5.0.14 was released over 9 years ago, I didn't really feel the
need to include that as part of the discussion. ;-)
> If you've got 5.6 or higher, your ideal solution is a perl script that
> grabs `ps -ef` (SysV -and- linux... Linux's procps honours -ef as SysV
> flags due to the leading dash; the dash says use SysV flags, the absence of
> a dash says use BSD flags), looks up every instance of all the appropriate
> programs, and weeds out the clerks and reports which have a parent which is
> also a clerk or report. A one-liner is out of the question in this event.
Use "ps -e -o sess,pid,comm". (Works on SCO and Linux. FreeBSD needs
"sid,pid,comm".)
Use your previous "grep", send to awk to grab just the sid, sort it, and
then pipe to uniq.
ps -e -o sess,pid,comm | grep [flags] | awk '{print $1}' | sort -n | wc -l
[...]
--
Kenneth Brody
More information about the Filepro-list
mailing list