X-Git-Url: http://gitweb.hugovil.com/?a=blobdiff_plain;f=stage1%2Fbootscripts%2Ffunctions;h=90d0c03fc8cb75dffc6f9aa27be0887a73d13cf0;hb=6007645124befc70ffe2fae5500022b215d59ce6;hp=7db7545ede57c60a16192e7ceb72b3f211bd5fba;hpb=c63c8a18e9d59b3ecc32acef349f8cb732eee511;p=hvlinux.git diff --git a/stage1/bootscripts/functions b/stage1/bootscripts/functions index 7db7545..90d0c03 100644 --- a/stage1/bootscripts/functions +++ b/stage1/bootscripts/functions @@ -14,12 +14,12 @@ export PATH="/tools/bin:/tools/sbin:/bin:/sbin" ## Screen Dimensions # Find current screen size if [ -z "${COLUMNS}" ]; then - COLUMNS=$(stty size) + COLUMNS=$(stty size < /dev/console) COLUMNS=${COLUMNS##* } fi # When using remote connections, such as a serial port, stty size returns 0 -if [ "${COLUMNS}" = "0" ]; then +if [ "${COLUMNS}" = "0" ]; then COLUMNS=80 fi @@ -76,7 +76,7 @@ print_status() echo "Usage: print_status {success|warning|failure}" return ${EXIT_CODE_FAILURE} fi - + case "$1" in success) ${SUCCESS} @@ -268,7 +268,7 @@ loadproc() pid="${pid} ${apid}" fi done - + # If the $pid variable contains anything (from the previous for loop) it # means the daemon is already running. if [ ! -n "${pid}" ]; then @@ -301,7 +301,7 @@ killproc() fi killproc_path ${1} /var/run ${2} - + return ${?} } @@ -316,7 +316,7 @@ killproc_path() msg_log "Usage: killproc_path {program} {pid-directory} [signal]" return ${EXIT_CODE_FAILURE} fi - + # Find the basename of the first parameter (the daemon's name without the # path). base=$(/usr/bin/basename ${1}) @@ -330,7 +330,7 @@ killproc_path() else nolevel=1 fi - + # The pidlist variable will contains the output of the pidof command. pidof # will try to find the PID's that belong to a certain string; $base in this # case. @@ -342,7 +342,7 @@ killproc_path() pid="${pid} ${apid}" fi done - + # If $pid contains something from the previous for loop it means one or # more PID's were found that belongs to the processes to be killed. if [ -n "${pid}" ]; then @@ -414,7 +414,7 @@ reloadproc() msg_log "Usage: reloadproc {program} [signal]" return ${EXIT_CODE_FAILURE} fi - + # Find the basename of the first parameter (the daemon's name without # the path that was provided so /usr/sbin/syslogd becomes plain 'syslogd' # after basename ran). @@ -429,7 +429,7 @@ reloadproc() else killlevel="-SIGHUP" fi - + # The pidlist variable will contains the output of the pidof command. pidof # will try to find the PID's that belong to a certain string; $base in this # case. @@ -441,7 +441,7 @@ reloadproc() pid="${pid} ${apid}" fi done - + # If $pid contains something from the previous for loop it means one or # more PID's were found that belongs to the processes to be reloaded. if [ -n "${pid}" ]; then @@ -449,7 +449,7 @@ reloadproc() if [ ${?} -ne 0 ]; then sleep 2 - if statusproc ${base} | grep -q "not running"; then + if statusproc ${base} | grep -q "stopped"; then return ${EXIT_CODE_FAILURE} fi fi @@ -458,7 +458,7 @@ reloadproc() msg_log "Not running" return ${EXIT_CODE_WARNING} fi - + return ${EXIT_CODE_SUCCESS} } @@ -474,7 +474,7 @@ statusproc() fi statusproc_path ${1} /var/run - + return ${?} } @@ -489,7 +489,7 @@ statusproc_path() msg_log "Usage: status {program} {pid-directory}" return ${EXIT_CODE_FAILURE} fi - + # Find the basename of the first parameter (the daemon's name without the # path). base=$(/usr/bin/basename ${1}) @@ -510,10 +510,11 @@ statusproc_path() if [ -f ${piddir}/${base}.pid ]; then pid=$(head -1 ${piddir}/${base}.pid) if [ -n "${pid}" ]; then - echo "${base} not running but ${piddir}/${base}.pid exists" + echo "${base} stopped but ${piddir}/${base}.pid exists" return ${EXIT_CODE_FAILURE} fi - else - echo "${base} is not running" fi + + echo "${base} is stopped" + return ${EXIT_CODE_FAILURE} }