
Monday August 09, 2004
Using poolbind to execute jobs in different pools
You are lazy. Of course you are, it's a virtue when applied to computing. You don't want to type reams of instructions and check to see if commands succeeded or failed. No way, that's just too time consuming. Joe Salaryman can waste his time doing that, but you've got better things to do.
In that case, here's a minimal script which wraps poolbind(1M) to make it easier to run a process in a particular pool. For example, let's say that I wanted to run ls(1) in pool "listings".
[1]
bash-2.05b$ newpool
usage: newpool <pool name> <command> [parameters]
[2]
bash-2.05b$ newpool listings ls
poolbind: binding pid 100964 to pool 'listings': Not owner
Bind operation failed
[3]
bash-2.05b$ su -
Password:
Sun Microsystems Inc. SunOS 5.10 s10_63 Jul. 03, 2004
SunOS Internal Development: gk 2004-07-03 [on10_63]
bfu'ed from /bfu/s10_63 on 2004-07-22
Sun Microsystems Inc. SunOS 5.10 s10_37 May 2004
You have mail.
# bash
[4]
bash-2.05b# newpool listings ls
backup bin Documents mnt tmp
bfu boot etc net TT_DB
bfu.ancestor cdbuild export opt usr
bfu.child cdrom home platform var
bfu.conflicts Desktop kernel proc vol
bfu.parent dev lib rootb
bfu.realmode devices lost+found sbin
bash-2.05b#
What's going on here?
- Run the script to display the usage message. It's fairly clear I think.
- Now try to run the script as myself. Oops, I'm don't have the privileges to bind to a differnt pool.
- I'll become root, I know I have enough privileges now ;-)
- Run it again and this time it works.
The script is simple:
#!/bin/sh
if [ $# -lt 2 ]
then
echo "usage: newpool <pool name> <command> [parameters]"
exit 2
fi
/usr/sbin/poolbind -p $1 $$
if [ $? != 0 ]
then
echo "Bind operation failed"
exit 1
fi
shift
exec $*
I mainly use this script when I'm developing resource pools and I want to launch test programs into different pools. My requirements are fairly minimal, so the script is perfect for me. Let me know if you have ideas for enhancements that would help make this script more useful.
(2004-08-09 02:37:36.0)
Permalink
|