Changeset 559

Show
Ignore:
Timestamp:
03/24/07 15:57:14 (2 years ago)
Author:
sacha
Message:

added optional argument to follow log file

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/bin/run-hefeweizen.sh

    r302 r559  
    2828############################################################################## 
    2929 
     30log_pid=0 
     31if [ $# -gt 0 ]; then 
     32    if [ $1 = "--show-log" -o $1 = "-l" ]; then 
     33        SRC_DIR=.. 
     34        source $SRC_DIR/defaults/hefeweizen-defaults 
     35         
     36        if [ -f $LOG_DIR/$LOG_FILE ]; then 
     37            echo -n 
     38        else 
     39            touch $LOG_DIR/$LOG_FILE 
     40            chown $SERVER_USER:$SERVER_GROUP $LOG_DIR/$LOG_FILE 
     41        fi 
     42         
     43        tail -n 0 -f $LOG_DIR/$LOG_FILE & 
     44        log_pid=$! 
     45    else 
     46        echo $1 not recognised 
     47        echo "Usage: run-hefeweizen.sh [--show-log | -l]" 
     48        exit -1 
     49    fi 
     50fi 
     51 
    3052start-stop-daemon -S -c hefeweizen --exec /usr/sbin/hefeweizen_ania.sh 
     53 
     54if [ $log_pid -gt 0 ]; then 
     55    # give the system 5 seconds to shut down 
     56    export log_pid 
     57    ( 
     58        sleep 5 
     59        kill -9 $log_pid 
     60        if [ $? -ne 0 ]; then 
     61            echo "Error stopping to show the log file. Check if process is still alive." 
     62        fi 
     63    ) & 
     64fi