Professional Documents
Culture Documents
UNIX
Student name:
Institution Affiliation:
2
unix
3
unix
#1/bin/sh
alist = 1. Do this activity;
blist= 2. Do that activity;
clist=3. Do another activity;
dlist=4. Create a group;
flist=5. Drop group;
elist=6. Create a User
glist=7. Stop User processes
hlist=8. Extras;
ilist= ;
wrongchoice () { MSG=Kindly select another option ; }
apick () { activity1 ; }
bpick () { activity2 ; }
cpick () { activity3 ; }
dpick () { cgrp ; }
epick () { dgrp ; }
fpick () { duser ; }
gpick () { kuproc ; }
hpick () { ext ; }
ipick () { wrongchoice ; }
thelist () {
clear
echo \t\tKindly select an option
echo
echo \t\t\t $alist
echo \t\t\t $blist
echo \t\t\t $clist
echo \t\t\t $dlist
echo \t\t\t $elist
echo \t\t\t $flist
echo \t\t\t $glist
4
unix
5
unix
#1/bin/sh
groupdel $batsgroup
Create a user
#1/bin/sh
#generate a User file with users names to input in a list
# the file name userslist.txt
if grep q ^${group}: /etc/group
for I in more userslist.txt
do
echo $i
adduser $i
done
#now run it
./userslist.txt
Drop a user
#1/bin/sh
for ttt in host1
do
echo $tt
ssh $ttt rmuser p batsuser
done
A script that will kill all of the processes associated with a user.
#1/bin/sh
#kill process
read p Input user name : username1
6
unix
top U username1
read p Input the process group name : procgrpname
while [true]
ps aux
do
echo input the process ID to kill
read procnum
echo Are you sure you want to kill $procnum?
echo 1 for yes, 2 for no
read chosen
if [ $chosen eq 1]
then
kill -9 $procnum
fi
done