Help with Script

Help with Script

Post by D Cla » Thu, 27 Jun 2002 02:54:43



I have a script with a while command in it that is causing some
problems. It works fine but if the users close their telnet session
the script starts eating up CPU usage and that is where the problem
is. Does someone have any suggestions for a replacement to the "while"
command that won't cause a runaway process if the users close their
telnet session. Here is the problem area in the script.
while [ $Done != 1 ]
   do
      echo "                             INFO LEASE ACCESS MENU\n"
      echo "Press the first character of the country you wish to
access (Ex. 'u'
 for usa)"
      echo "or 'q' to quit and exit the system. \n\nCountries
available to you:\
n"
      echo "$dbaccesslist\n"
      echo "Your Choice>\c"
      read selection

      case $selection in
      q|Q )  exit 0;;
      [a-z]|[A-Z]|[0-9] )
         dbname=`grep ^$selection ~$USER/infolease_dblist | awk
'{print $2}'`

         if [ "$dbname" != "" ]
         then
            Done=1
         else
            clear
         fi;;    

Any suggestions or tips would be appreciated.
THANKS!!! D. Clark                  

 
 
 

Help with Script

Post by Ed Wrigh » Fri, 28 Jun 2002 05:54:16


#!/bin/ksh
# script demonstrating the use of the select command
PS3="Enter choice: "
select i in "List current directory"\
                "Whos logged on"\
                "Date and Time"\
                "Quit"
do
                case ${REPLY} in
                        1 ) ls -C ;;
                        2 ) who ;;
                        3 ) date ;;
                        4 ) break ;;
                        * ) echo "Invalid response" ;;
                esac
done

>I have a script with a while command in it that is causing some
>problems. It works fine but if the users close their telnet session
>the script starts eating up CPU usage and that is where the problem
>is. Does someone have any suggestions for a replacement to the "while"
>command that won't cause a runaway process if the users close their
>telnet session. Here is the problem area in the script.
>while [ $Done != 1 ]
>   do
>      echo "                             INFO LEASE ACCESS MENU\n"
>      echo "Press the first character of the country you wish to
>access (Ex. 'u'
> for usa)"
>      echo "or 'q' to quit and exit the system. \n\nCountries
>available to you:\
>n"
>      echo "$dbaccesslist\n"
>      echo "Your Choice>\c"
>      read selection

>      case $selection in
>      q|Q )  exit 0;;
>      [a-z]|[A-Z]|[0-9] )
>         dbname=`grep ^$selection ~$USER/infolease_dblist | awk
>'{print $2}'`

>         if [ "$dbname" != "" ]
>         then
>            Done=1
>         else
>            clear
>         fi;;    

>Any suggestions or tips would be appreciated.
>THANKS!!! D. Clark                  


Do a good thing
Visit and support
http://home.pacifier.com/~wildones
A Fine Cat Sanctuary
I hope one day to become the kind of person my cat thinks I am

vidi venci veni

 
 
 

1. expect script help - example script included

I am using expect to submit a PEM passphrase for httpsd. I have the httpsd
script call a little expect script that starts httpsd and supplies the
password.

For some reason, although expect is starting httpsd just fine, it seems to
die right away:

________________________________________________________
[Mon Nov  5 17:07:30 2001] gcache started
[Mon Nov  5 17:07:30 2001] gcache started
[Mon Nov  5 17:07:30 2001] [notice] Apache/1.3.12 Ben-SSL/1.40 (Unix)
configured
 -- resuming normal operations
[Mon Nov  5 17:13:40 2001] [notice] caught SIGTERM, shutting down
________________________________________________________

If I start httpsd manually and enter the password manually, it starts fine
and stays alive.

My expect script resembles several example scripts that are supposed to
work; am I missing something obvious?

________________________________________________________
#!/usr/bin/expect
set pass "password"
spawn /usr/sbin/httpsd -DSSL -f /etc/httpsd/conf/httpsd.conf
set send_slow {1 .1}
expect "*rase:"
sleep .1
send "$pass\r"
expect "pid="
sleep .1
expect eof
________________________________________________________

Thanks.

2. Redirecting logs to terminal

3. Shell script help, shutdown script

4. sever error

5. HELP!! A little help please..scripting.

6. Problems when trying to update kernel from 2.0.32 to 2.0.34

7. *****************HELP*****on script*******HELP**************

8. Symbolic links NEWBIE

9. Help: Boot-Script

10. HELP:: Shell Script - Background Process

11. Urgent Help with Script Needed

12. HELP with script files!

13. re help with script