Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- LOGDIR=`dirname $0`/../../log/
- TIMESTAMP=$(date +"%H:%M:%S")
- DATE=$(date +%d-%m-%y)
- if [[ ! -d $LOGDIR ]]; then
- mkdir -p $LOGDIR
- echo "$TIMESTAMP [WRAPPER] Logdir is set to $LOGDIR" >> $LOGDIR/stdlog_$DATE
- fi
- echo "$TIMESTAMP [WRAPPER] Call control script `dirname $0`/`basename $0`-wrapped with params [$@]" >> $LOGDIR/stdlog_$DATE
- # | sed -e "s/^/$TIMESTAMP/"
- `dirname $0`/`basename $0`-wrapped "$@" > >(sed -e "s/$TIMESTAMP //g;s/^/$TIMESTAMP /" | tee -a $LOGDIR/stdlog_$DATE) 2> >(sed -e "s/^/$TIMESTAMP /" | tee -a $LOGDIR/errlog_$DATE)
- WRAPPEDEXIT=$?
- if [ $WRAPPEDEXIT -eq 1 ]; then
- echo "$TIMESTAMP [WRAPPER] The control script `dirname $0`/`basename $0`-wrapped finished with exit code 1. Try $0 {start|stop|restart|init|uninstall}" >> $LOGDIR/errlog_$DATE
- echo "$TIMESTAMP [WRAPPER] The control script `dirname $0`/`basename $0`-wrapped finished with exit code 1. See $LOGDIR/errlog_$DATE for more information" >> $LOGDIR/stdlog_$DATE
- else
- echo "$TIMESTAMP [WRAPPER] The control script `dirname $0`/`basename $0`-wrapped finished with exit code $WRAPPEDEXIT" >> $LOGDIR/stdlog_$DATE
- fi
- exit $WRAPPEDEXIT
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement