Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Menu Options to allow CMSADM backup and Reboot

Status
Not open for further replies.

Stinney

IS-IT--Management
Nov 29, 2004
2,029
US
We don't like to share access to our CMS system outside of the telecom group. However, it is helpful to have the Networking team reboot and backup the system as our primary CMS is about 50 miles from where I work and they have to go on site once a month for other systems.

I created a root user login and changed the set path in the local.cshrc user file to point to the directory where I have the script file saved, I put the script in a directory I created: appbin/sys_maint and put the script named cmsadmbu in it:

set path=(/bin /usr/bin /usr/ucb /etc /appbin/sys_maint/ .)

I also added the path for the file to run in the local.profile of the user:

PATH=$PATH:/appbin/user_maint
export PATH

/appbin/sys_maint/cmsadmbu

You also have to edit the passwd file in the /etc directory so the user's path is the directory and filename of the script (I used the username cmsadmbu):

cmsadmbu:x:0:1::/export/home/cmsadmbu:/appbin/sys_maint/cmsadmbu

Note that the cmsadmbu is setup with root access :)x:0:1::) make sure to edit this after setting up the user as well.

With the user setup this way, when the user logs in, it only runs the cmsadmbu script. If they ^z to stop the script, or try to stop it any other way, it will log them out.

If the user logs in on the console directly, make sure they change the Options to Command Line Login, or they will lock up the login screen.


Make sure you make the script executable by executing the command: chmod 755 [filename]

########HERE IS THE SCRIPT######

#!/usr/bin/ksh

#This script allows the user to run the cmsadm backup and to reboot the system.


get_response()
{
read response

case x"$response" in
xQuit|xquit|xQUIT|xq|xQ)
exit;;
x) response=$1;
export response;;
esac
}

invalid_selection()
{
sleep 1
print
print
print
print "*********************************"
print "Invalid selection"
print "*********************************"
print

}

cms_admbu()
{
/cms/install/bin/backup
}

reboot()
{
/usr/sbin/shutdown -y -g0 -i6
}

while : ;
do
print
print
print
print "Please enter your selection:"
print "1 - CMSADM Backup"
print "2 - CMS Reboot"
print "or enter q to quit"
print
print -n "ENTER: "
get_response
SELECTX=$response
if [ "$SELECTX" = "1" ]
then
cms_admbu
fi
if [ "$SELECTX" = "2" ]
then
reboot
fi
done



- Stinney

Quoting only proves you know how to cut and paste.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top