12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- #!/bin/sh
- ################################################################################
- # Copyright (C) 2011 HPCC Systems.
- #
- # All rights reserved. This program is free software: you can redistribute it and/or modify
- # it under the terms of the GNU Affero General Public License as
- # published by the Free Software Foundation, either version 3 of the
- # License, or (at your option) any later version.
- #
- # This program is distributed in the hope that it will be useful,
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- # GNU Affero General Public License for more details.
- #
- # You should have received a copy of the GNU Affero General Public License
- # along with this program. If not, see <http://www.gnu.org/licenses/>.
- ################################################################################
- #################################################
- ## Defaulting needed for new init system ##
- #################################################
- : ${LIBDIR:="."} #
- : ${BINDIR:="."} #
- export PATH=$BINDIR:$PATH #
- export LD_LIBRARY_PATH=$LIBDIR:$LD_LIBRARY_PATH #
- #################################################
- DESTDIR=`dirname $0`
- cd $DESTDIR
- if [ "_$1" != "_loop" ]; then
- nohup $0 loop $* &>/dev/null &
- exit 0
- fi
- rm -f /var/run/dafilesrv.pid
- killall -9 dafilesrv 2> /dev/null
- sleep 1
- export PATH=`pwd`:$DESTDIR:$PATH
- export LD_LIBRARY_PATH=.
- ulimit -n 8192
- ulimit -c unlimited
- # dafilesrv is searched for in CURRENT_VERSION dir (if exists)
- # or /c$/dafilesrv
- # then $DESTDIR (location of scripts)
- # then $PATH
- if [ -e CURRENT_VERSION ]; then
- cd `cat CURRENT_VERSION`
- export PATH=`pwd`:$DESTDIR:$PATH
- export LOPT="-L /c$/dafilesrv"
- else
- export PATH=`pwd`:$DESTDIR:$PATH
- export LOPT=
- fi
- $BINDIR/dafilesrv -D $LOPT 1>/dev/null
- sleep 1
- pid=`pidof -x dafilesrv`
- if [ "$?" -eq "0" ]; then
- echo $pid > /var/run/dafilesrv.pid
- fi
- while [ -e /var/run/dafilesrv.pid ] && [ "`cat /var/run/dafilesrv.pid`" -eq "$pid" ]; do
- kill -0 $pid 2> /dev/null
- if [ "$?" -eq "0" ]; then
- sleep 60
- else
- rm -f /var/run/dafilesrv.pid
- killall -9 dafilesrv 2> /dev/null
- sleep 1
- $BINDIR/dafilesrv -D $LOPT 1>/dev/null
- sleep 1
- pid=`pidof -x dafilesrv`
- if [ "$?" -eq "0" ]; then
- if [ ! -e /var/run/dafilesrv.pid ]; then
- echo $pid > /var/run/dafilesrv.pid
- fi
- fi
- fi
- done
-
-
-
|