[K12OSN] disallowing multiple instances within a certian period.

Sudev Barar sbarar at gmail.com
Thu Nov 17 01:47:07 UTC 2005


On 11/15/05, Peter Hartmann <ascensiontech at gmail.com> wrote:
> > I can pull out the script if you need.
>
> Sure that would be great.
>

The script is below (watch out if any  line is wrapped round):

p=`ps -u $USER | grep dosemu | wc -l`
q=`cat /etc/dosid.conf | grep $USER | cut -d ":" -f 2`
if [ $q -gt $p ]
then
	echo "execute here"
	/path/to/program
else
	dialog --title "Linux Dialog Utility Msgbox" --backtitle "Linux Alert
Message" --msgbox "You are already running maximum permitted sessions
\n  Press any key. .. " 9 50
fi

We have defined maximum sessions for each user in the file
/etc/dosid.conf so that some users are allowed to run only one session
while others can run two or three. File layout is :
usera 1
userb 2
userc 1.......

--
Sudev Barar
Learning Linux




More information about the K12OSN mailing list