HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Unix Script to limit # of Baan users
Operating System - HP-UX
1834156
Members
2848
Online
110064
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2004 07:51 AM
06-11-2004 07:51 AM
Unix Script to limit # of Baan users
The script is attached and the following is the results of the "ps -ef | grep rroth":
rroth 25266 623 0 14:29:50 ? 0:00 /bin/ksh /baan/bse/bin/script6.2 -1 545 0 1
rroth 25275 25266 0 14:29:51 ? 0:06 /baan/bse/bin/bshell -1 545 0 1
rroth 25276 25275 0 14:29:53 ? 0:00 oracle8 (rroth:25275/PIPE) 25275 321 10 11
rroth 25278 1 0 14:29:53 ? 0:00 oraclebaanIV (DESCRIPTION=(LOCAL=YES)(SDU=8192)(TDU=8192)(AD
rroth 25266 623 0 14:29:50 ? 0:00 /bin/ksh /baan/bse/bin/script6.2 -1 545 0 1
rroth 25275 25266 0 14:29:51 ? 0:06 /baan/bse/bin/bshell -1 545 0 1
rroth 25276 25275 0 14:29:53 ? 0:00 oracle8 (rroth:25275/PIPE) 25275 321 10 11
rroth 25278 1 0 14:29:53 ? 0:00 oraclebaanIV (DESCRIPTION=(LOCAL=YES)(SDU=8192)(TDU=8192)(AD
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2004 08:06 AM
06-11-2004 08:06 AM
Re: Unix Script to limit # of Baan users
Are you trying to limit a certain user or limit oracle?
Need a bit more from you.... why are you doing it and what is your goal.
Need a bit more from you.... why are you doing it and what is your goal.
Unix, the other white meat.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2004 08:19 AM
06-11-2004 08:19 AM
Re: Unix Script to limit # of Baan users
Using grep and ps ALWAYS leads to trouble. Since all you are looking for is the current user (I assume that $USER is the user's login), let ps do all the work:
ps -f -u$USER
This shows every process that $USER is running. Note that there will be a header to ignore.
Your script will fail in many ways. If USER=bill then it will capture user billy, hillbilly and even processes named billing...grep matches anything on the ps line. ps -u$USER matches EXACTLY the user name.
The same warning applies to the second ps grepping for bshell. It will find bombshell and other variants, whether login names, argument to scripts or user processes. Again, ps can search for an EXACT match, in this case, the program name. But you need to turn on XPG4 behavior with the UNIX95 variable. Try this:
UNIX95= ps -C bshell -o pid,args
This construct introduces two special options, -C for an exact process_name match, and -o for do-it-yourself items. The man page for ps tells all about the new options. Now your messaging command simplifies to this:
UNIX95= ps -C bshell -o pid,args | while read MYPID,ARGS
do
if [ $MYPID != "PID" ]
then
bshcmd6.1 -w1 -u1 -M "Warning: you are only allowed to login ${ALLOWED_LOGINS} time(s)! Please close this window" ${MYPID}
fi
done
Note that ps always puts out a header so you have to skip $MYPID when it is "PID".
Bill Hassell, sysadmin
ps -f -u$USER
This shows every process that $USER is running. Note that there will be a header to ignore.
Your script will fail in many ways. If USER=bill then it will capture user billy, hillbilly and even processes named billing...grep matches anything on the ps line. ps -u$USER matches EXACTLY the user name.
The same warning applies to the second ps grepping for bshell. It will find bombshell and other variants, whether login names, argument to scripts or user processes. Again, ps can search for an EXACT match, in this case, the program name. But you need to turn on XPG4 behavior with the UNIX95 variable. Try this:
UNIX95= ps -C bshell -o pid,args
This construct introduces two special options, -C for an exact process_name match, and -o for do-it-yourself items. The man page for ps tells all about the new options. Now your messaging command simplifies to this:
UNIX95= ps -C bshell -o pid,args | while read MYPID,ARGS
do
if [ $MYPID != "PID" ]
then
bshcmd6.1 -w1 -u1 -M "Warning: you are only allowed to login ${ALLOWED_LOGINS} time(s)! Please close this window" ${MYPID}
fi
done
Note that ps always puts out a header so you have to skip $MYPID when it is "PID".
Bill Hassell, sysadmin
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP