help me


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting help me
# 1  
Old 11-13-2004
Bug help me

hi dear members!

i have proxy server on Freebsd and i have create a account (myuser) this user access my Freebsd machine anywhere through telnet and ssh. now i want when this user access my machine a script run.... like

[1] edit squid.conf file
[2] stop squid process
[3] restart squid process
[x] exit.....

now when (myuser) click 1 /usr/local/squid/etc/squid.conf file open for editing and then he exit from text editor again previous script appear

[1] edit squid.conf file
[2] stop squid process
[3] restart squid process
[x] exit.....

same this process work on option (2,3) and x for exit

plz help me how i can do that in shell scripting i use bash for default shell

thanks

Umar Draz
# 2  
Old 11-13-2004
Try this:

#!/bin/sh

echo "(1) Edit File /testfile"
echo "(2) Stop Process"
echo "(3) Restart Process"
echo "(x) EXIT"

read CHOICE

case $CHOICE in

1)

vi /testfile
;;

2)

/etc/init.d/process stop
;;

3)

/etc/init.d/process restart
;;

x)

exit 0

;;

esac

Hope this Helps (should also work under Bash , I´ve tried it on sh )

n3tw0rkfr34K
# 3  
Old 11-22-2004
Re-Help

Hi Dear!

its a good script i have done with it but there is some technical issue in this script..

when i choose

[1] edit squid.conf file (option

its open the squid.conf their i have done my work and exit in squdi.conf file then i got shell

like
-bash-2.05b$

its a big fault i want when i quit squid.conf file then again

[1] edit squid.conf file
[2] stop squid process
[3] restart squid process
[x] exit.....

script will appear until user press [x] option

and another fault is if i hit Ctrl+C then this script is off and i got

-bash-2.05b$

i want user's did't use any thing like (Ctrl+C, Ctrl+D, Ctrl+Z)

thanks and regards

Umar DRaz
Login or Register to Ask a Question

Previous Thread | Next Thread
Login or Register to Ask a Question