Skip to content

Commit

Permalink
Refactored Linux startup scripts:
Browse files Browse the repository at this point in the history
* Added Timestamp to logs
* Added stdout and stderr Output to log files
  • Loading branch information
Daniel Kroeger committed Jan 28, 2014
1 parent 7ec603a commit 0b72b17
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
17 changes: 9 additions & 8 deletions Utilities/Linux/StartupScripts/RedHat/womonitor
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -17,6 +17,7 @@
USER=wouser
NEXT_ROOT="/opt"
export NEXT_ROOT
TIME="[`date +%d.%m.%Y\ %H:%M:%S`]:"

###############################################################################

Expand Down Expand Up @@ -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
;;
Expand Down
11 changes: 6 additions & 5 deletions Utilities/Linux/StartupScripts/RedHat/wotaskd
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
USER=wouser
NEXT_ROOT="/opt"
export NEXT_ROOT
TIME="[`date +%d.%m.%Y\ %H:%M:%S`]:"

###############################################################################

Expand Down Expand Up @@ -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
;;
Expand Down

0 comments on commit 0b72b17

Please sign in to comment.