From 0b72b177a4b0494eeb33640ebef60435f5464ddd Mon Sep 17 00:00:00 2001 From: Daniel Kroeger Date: Tue, 28 Jan 2014 11:19:28 +0100 Subject: [PATCH] Refactored Linux startup scripts: * Added Timestamp to logs * Added stdout and stderr Output to log files --- Utilities/Linux/StartupScripts/RedHat/womonitor | 17 +++++++++-------- Utilities/Linux/StartupScripts/RedHat/wotaskd | 11 ++++++----- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/Utilities/Linux/StartupScripts/RedHat/womonitor b/Utilities/Linux/StartupScripts/RedHat/womonitor index 8b8cc8d95ce..14ec4b3b0ee 100755 --- a/Utilities/Linux/StartupScripts/RedHat/womonitor +++ b/Utilities/Linux/StartupScripts/RedHat/womonitor @@ -1,7 +1,7 @@ -#!/bin/bash +#! /bin/bash -# chkconfig: - 90 20 -# description: Provides JavaMonitor service +# chkconfig: 90 20 +# description: Provides womonitor service ### BEGIN INIT INFO # Provides: womonitor @@ -17,6 +17,7 @@ USER=wouser NEXT_ROOT="/opt" export NEXT_ROOT +TIME="[`date +%d.%m.%Y\ %H:%M:%S`]:" ############################################################################### @@ -47,17 +48,17 @@ case "$1" in status) WOMONITOR_PID=`ps aux | awk '/WOPort 1086/ && !/awk/ {print $2}'` if [ "$WOMONITOR_PID" != "" ]; then - echo "Service is running with PID $WOMONITOR_PID" | tee -a /var/log/womonitor.log + echo "$TIME Service is running with PID $WOMONITOR_PID" 2>&1 | tee -a /var/log/womonitor.log else - echo "Service is not running" | tee -a /var/log/womonitor.log + echo "$TIME Service is not running" 2>&1 | tee -a /var/log/womonitor.log fi ;; start) - echo "Starting womonitor: " | tee -a /var/log/womonitor.log - su $USER -c -l "$NEXT_ROOT/Library/WebObjects/JavaApplications/JavaMonitor.woa/JavaMonitor -WOPort 1086 | tee -a /var/log/womonitor.log &" + echo "$TIME Starting womonitor: " 2>&1 | tee -a /var/log/womonitor.log + su $USER -c -l "$NEXT_ROOT/Library/WebObjects/JavaApplications/JavaMonitor.woa/JavaMonitor -WOPort 1086 2>&1 | tee -ai /var/log/womonitor.log &" ;; stop) - echo "Shutting down womonitor: " | tee -a /var/log/womonitor.log + echo "$TIME Shutting down womonitor: " 2>&1 | tee -a /var/log/womonitor.log WOMONITOR_PID=`ps aux | awk '/WOPort 1086/ && !/awk/ {print $2}'` kill $WOMONITOR_PID ;; diff --git a/Utilities/Linux/StartupScripts/RedHat/wotaskd b/Utilities/Linux/StartupScripts/RedHat/wotaskd index b85d584cd1f..139450de202 100755 --- a/Utilities/Linux/StartupScripts/RedHat/wotaskd +++ b/Utilities/Linux/StartupScripts/RedHat/wotaskd @@ -18,6 +18,7 @@ USER=wouser NEXT_ROOT="/opt" export NEXT_ROOT +TIME="[`date +%d.%m.%Y\ %H:%M:%S`]:" ############################################################################### @@ -48,17 +49,17 @@ case "$1" in status) WOTASKD_PID=`ps aux | awk '/WOPort 1085/ && !/awk/ {print $2}'` if [ "$WOTASKD_PID" != "" ]; then - echo "Service is running with PID $WOTASKD_PID" | tee -a /var/log/wotaskd.log + echo "$TIME Service is running with PID $WOTASKD_PID" 2>&1 | tee -a /var/log/wotaskd.log else - echo "Service is not running" | tee -a /var/log/wotaskd.log + echo "$TIME Service is not running" 2>&1 | tee -a /var/log/wotaskd.log fi ;; start) - echo "Starting wotaskd: " | tee -a /var/log/wotaskd.log - su $USER -c -l "$NEXT_ROOT/Library/WebObjects/JavaApplications/wotaskd.woa/wotaskd -WOPort 1085 | tee -a /var/log/wotaskd.log &" + echo "$TIME Starting wotaskd: " 2>&1 | tee -a /var/log/wotaskd.log + su $USER -c -l "$NEXT_ROOT/Library/WebObjects/JavaApplications/wotaskd.woa/wotaskd -WOPort 1085 2>&1 | tee -a /var/log/wotaskd.log &" ;; stop) - echo "Shutting down wotaskd: " | tee -a /var/log/wotaskd.log + echo "$TIME Shutting down wotaskd" 2>&1 | tee -a /var/log/wotaskd.log WOTASKD_PID=`ps aux | awk '/WOPort 1085/ && !/awk/ {print $2}'` kill $WOTASKD_PID ;;