1748163 Members
3810 Online
108758 Solutions
New Discussion юеВ

Re: HelpDesk Script

 
SOLVED
Go to solution
Charles Keyser
Frequent Advisor

Re: HelpDesk Script

I commented this out
#sudo /usr/lbin/modprpw -x ${USER}

Added
/usr/local/bin/sudo /usr/lbin/modprpw -x ${USER}

And it worked just fine. Thanks for all of yor help
-Charlie
Pete Randall
Outstanding Contributor

Re: HelpDesk Script

As you become more experienced in Sysadmin work, one of the habits you should acquire is to always use full path names in your scripts and make sure all your environment variables are defined.

Whoever wrote this script (I'm assuming it wasn't you) should scold herself!


Pete

Pete
Rita C Workman
Honored Contributor

Re: HelpDesk Script

Once you have the correct path for where sudo is installed, put it in the line where sudo is used that you mentioned earlier (in your case 4 stmt...)

...and whoever edited my script needs to go back and fix it; cause he menu is off from commands. If you're gonna change it - do it right.

Kindest regards,
Rita
Charles Keyser
Frequent Advisor

Re: HelpDesk Script

Rita

Sorry, I am just trying to fix what is there. I did not mean to offend or make anyone angry. The script is awesome and will work for us to do what we need. My apologies

-Charlie
Rita C Workman
Honored Contributor

Re: HelpDesk Script

Offend....it didn't come out right....I am totally flattered!

Maybe one day I'll share the one I wrote to cleanup some logfiles on Itanium boxes, cause they took out SAM and that quickie logfiles cleanup utility.

Kindest regards,
Rita
Charles Keyser
Frequent Advisor

Re: HelpDesk Script

Thanks Rita. I appreciate that. The script keeps me from being woke up in the early AM where the Help Desk folks can log in run the script get the password and send the folks on their merry way.

Again Thank you
-Charlie
Rita C Workman
Honored Contributor

Re: HelpDesk Script

I didn't use sudo............


ha ha....

Rita
Rita C Workman
Honored Contributor

Re: HelpDesk Script

OK.............hope this helps you a little. It's still looking for the path for sudo you need to enter.

Regards,
Rita
-------------------------------------------

# Script is for the Help Desk to perform tasks for the sysadmin. These are limited and restricted to the Help Desk only.
# Any additional problems or issues, the Help Desk will contact the Sysadms to resolve them.
#
# Modified: 3/10/10 /rcw To cleanup over appearance of script and put lines in order
# To include full path statement on commands
#
###############################################################
#!/usr/bin/sh
#
#
#
set -u
trap '' INT
function cont
{
print -n "Do You Wish to Continue Y/N : "
read answ
if [[ $answ = [Yy] ]]
then
return 0
else
return 1
fi
}
while true
do
clear
print -n "
* HELP DESK MENU *
$(uname -n)
HELLO: $(whoami)
===================================================
*************************
* ATI ALLVAC Help Desk *
*************************


Display printer status / print jobs.
1a. To view status one select printer
1b. To view status on all printers

2. Cancel a print job.

3. Cancel ALL print jobs for a printer.

4. Unlockes and Resets User Passwords
NOTE: A number or a group of letters will show on the screen,
write down and provide this information to the user.

5. This will execute the TOP command to look at the high load average on the servers. Monitoring purposes
NOTE: Control C breaks the process and returns to the Main Menu

6. EXIT this program.


===================================================

Select an Option # from above: "

read answer
case "$answer" in
6*|Qq|bye|Ee ) print "Quitting! See You Later, $(whoami)" ; exit ;;
5) if cont
then
/usr/bin/top
fi;;
1a) if (( $? == 0 ))
then
print -n "Enter Printer Name: "
read prtr
/usr/bin/lpstat $prtr
print -n "OK to clear screen [Hit Any Key]"
read h
fi;;
1b) if (( $? == 0 ))
then
print -n "Status of All Printers"
sleep 2
/usr/bin/lpstat -a
print -n "OK to clear screen [Hit Any Key]"
read h
fi;;

2) if (( $? == 0 ))
then
print -n "Enter Printer Name-job#: "
read prtr
/usr/bin/cancel $prtr
fi;;
3) if (( $? == 0 ))
then
print -n "..Enter printer name :"
read prtr_name
print -n "You enter printer ${prtr_name}"
print -n " Is this correct Y/N "
read answ
if [[ "$answ" = [Yy] ]]
then
/usr/bin/lpstat $prtr_name | grep $prtr_name | sort -k1 | cut -d " " -f1 > $prtr_name.out
for rem_prt in `cat $prtr_name.out`
do
/usr/bin/cancel $rem_prt
done
else
echo "No Such Printer"
fi
fi;;
4) echo "Username to modify \c"; read USER
TESTUSER=`awk -v USER=${USER} -F: '$1~USER { print $1 }' /etc/passwd`
if test "${USER}" != "${TESTUSER}"
then
echo "${USER} is invalid!"
echo "Press [ENTER] to continue. \c"
read NOTHING
else
#This command looks at the account if it has a password liftime expired it will reset the account and enable it
sudo /usr/lbin/modprpw -x ${USER}
sleep 10
#This command runs the password reset brings up a prompt and 3 choices, selcting 3 is the best for the help desk
#passwd ${USER}
fi;;
5) if cont
then
/usr/bin/top
fi;;
esac
done
Rita C Workman
Honored Contributor

Re: HelpDesk Script

no guarantees....I did it quick & didn't test it.

no points please..