how many users?
Bruce Easton
bruce at stn.com
Thu Dec 5 07:13:17 PST 2013
Top-post:
Overly-expensive for me is when I have to remember different flags for
diff. versions of *nixes. I suppose that's why my initial response on
this had "ps -ef". Granted egrep is better suited for the regex, but if
I know something simpler to key on one command line, and perhaps easier
to read by others, I gravitate towards it, which is why I went the "grep
-e xxx -e yyy -e zzz" route. In any case, I surely could use more memory :)
Also, as I stated in the follow-up to my initial response, be aware that
including "grep -v grep" could lead to undesired results if there is the
likelihood of a filepro file/format name containing "grep". Including
more of the command should make it safer since it would be unlikely for
an fp call:
grep -v "grep -e"
Bruce
On 12/4/13 7:34 PM, Fairlight wrote:
> Top-post:
>
> My God, that's overly expensive. Every chain I've seen posted has been.
> Why not use the proper version of grep which has desirable regex support?
>
> ps auxww | egrep "([dr](clerk|report))|runmenu" | grep -v grep | wc -l
>
> That's it. Done. Well, more or less. It counts all runtime and
> development versions of clerk and report. I believe you need to count
> [dr]cabe, ddefine, dxmaint, dmoedef, and dscreen as well, to get the full
> count. I'm not 100% sure -all- of those binaries use licenses, but I
> know cabe does, and it was just posted that runmenu does (at least on
> Windows, so I'm extrapolating to *nix). It makes sense that if runmenu
> does, the rest do. Add or remove command names as necessary.
>
> ps auxww | egrep "([dr](clerk|report|cabe))|runmenu|dxmaint|dscreen|ddefine|dmoedef" | grep -v grep | wc -l
>
> If you're stuck with a SysV version of `ps`, use '-aef' instead of 'auxww'
> for options.
>
> ONE line. ONE.
>
> mark->
>
> On Mon, Dec 02, 2013 at 11:29:44AM -0600, Richard D. Williams thus spoke:
>> Ernie,
>>
>> What a simple solution.
>> I do not know if it is "exactly" how fp does it, but it would give me a
>> very close number.
>>
>> Here is the script:
>>
>> rm -f /tmp/fpnum.txt
>> ps -ef | grep dclerk >> /tmp/fpnum.txt
>> ps -ef | grep rclerk >> /tmp/fpnum.txt
>> ps -ef | grep rreport >> /tmp/fpnum.txt
>> ps -e f | grep dreport >> /tmp/fpmun.txt
>> wc -l /tmp/fpnum.txt | awk {' print $1 }'
>>
>> This can now be set into a script /usr/local/bin/count_fpusers and used
>> inside a filepro program as a user command.
>>
>> user uniq = /usr/local/bin/count_fpusers;n(4,.0)=uniq;close uniq;msgbox n
>>
>> Wow. Senior moment. I went to write this script and found I had already
>> figured this out years ago.
>>
>> Here is the script:
>>
>> DATE="`date '+%m/%d/%y|%H:%M:%S'`"
>> ps -ef | grep clerk > /tmp/FPUSERS.txt
>> ps -ef | grep report >> /tmp/FPUSERS.txt
>> FPUSERS="`cat /tmp/FPUSERS.txt | wc -l`"
>> echo "$DATE|$FPUSERS|" >> /appl/LOG_FPUSERS
>>
>> I use this to keep a running log of the number of users every 10 mins..
>>
>> The new script above still will work as needed within any filepro program.
>>
>> Thanks for the help.
>>
>> Richard D. Williams
>>
>>
>>
>>
>> ps -ef |grep rclerk
>>
>> On 12/2/2013 10:53 AM, ernieb59 wrote:
>>> Richard,
>>> ps -ef |grep rclerk
>>> will show how many instances of 'rclerk' are running.
>>> Same for any filePro executable.
>>>
>>> Ernie
>>>
>>>
>>> -----Original Message-----
>>> From: filepro-list-bounces+ernieb59=gmail.com at lists.celestial.com
>>> [mailto:filepro-list-bounces+ernieb59=gmail.com at lists.celestial.com] On
>>> Behalf Of Richard D. Williams
>>> Sent: Monday, December 02, 2013 9:18 AM
>>> To: filepro-list at lists.celestial.com
>>> Subject: how many users?
>>>
>>> Is there a way to determine the number of filepro users from the command
>>> line in a linux system?
>>>
>>> Richard
>>> _______________________________________________
>>> Filepro-list mailing list
>>> Filepro-list at lists.celestial.com
>>> Subscribe/Unsubscribe/Subscription Changes
>>> http://mailman.celestial.com/mailman/listinfo/filepro-list
>>> -----
>>> No virus found in this message.
>>> Checked by AVG - www.avg.com
>>> Version: 2014.0.4259 / Virus Database: 3629/6884 - Release Date: 12/02/13
>>>
>>>
>>>
>>>
>> _______________________________________________
>> Filepro-list mailing list
>> Filepro-list at lists.celestial.com
>> Subscribe/Unsubscribe/Subscription Changes
>> http://mailman.celestial.com/mailman/listinfo/filepro-list
>>
More information about the Filepro-list
mailing list