[Bug 13] Bootscripts clean up

bugzilla at linuxfromscratch.org bugzilla at linuxfromscratch.org
Tue Sep 18 10:30:50 PDT 2001


http://bugs.linuxfromscratch.org/show_bug.cgi?id=13





------- Additional Comments From gerard at linuxfromscratch.org  2001-09-18 10:30 -------
>From Jeff Neitzel:

I noticed the statusproc function has a couple errors making it not work       
                                                                               
      
correctly when checking for stale PID files. I fixed it. Changes are           
                                                                               
      
marked below. The complete function, with comments, is attached here as        
                                                                               
      
statusproc.gz .                                                                
                                                                               
      
                                                                               
                                                                               
      
# redirect usage message to stderr                                             
                                                                               
      
echo "Usage: status {program}" >&2                                             
                                                                               
      
                                                                               
                                                                               
      
# need basename of executable to find PID in /var/run                          
                                                                               
      
base=${1##*/}                                                                  
                                                                               
      
                                                                               
                                                                               
      
    # need use $base here instead of $1 . $1 doesn't work for getting          
                                                                               
      
    # proper PID file from /var/run .                                          
                                                                               
      
    if [ -f /var/run/$base.pid ]; then                                         
                                                                               
      
        # changed /usr/bin/head -1 to cat                                      
                                                                               
      
        pid=$(cat /var/run/$base.pid);                                         
                                                                               
      
        if [ -n "$pid" ]; then                                                 
                                                                               
      
            echo "$1 is not running, but /var/run/$base.pid exists.";          
                                                                               
      
            return 1;                                                          
                                                                               
      
        fi;                                                                    
                                                                               
      
    else                                                                       
                                                                               
      
        echo "$1 is not running.";                                             
                                                                               
      
    fi
-- 
Unsubscribe: send email to listar at linuxfromscratch.org
and put 'unsubscribe lfs-book' in the subject header of the message



More information about the lfs-book mailing list