X-Git-Url: http://git.indexdata.com/?p=yazpp-moved-to-github.git;a=blobdiff_plain;f=src%2Fproxy.sh;h=8adf7e025fd5564e54cd77db30ab11b4574dca12;hp=3e1fc16dfb1e6160fdc92e1927c6dc1f53b4e758;hb=1cf760aa1600199b8a9acb4ccaded655f6903d62;hpb=ea5275ed931fa06ac765dfb49e5af2036a6ec8b3 diff --git a/src/proxy.sh b/src/proxy.sh index 3e1fc16..8adf7e0 100755 --- a/src/proxy.sh +++ b/src/proxy.sh @@ -12,27 +12,26 @@ PATH=/usr/local/bin:/bin:/usr/bin export PATH -RUNAS=nobody -LOGFILE=/var/log/proxy.log - -if test `whoami` != $RUNAS; then - touch $LOGFILE - chown $RUNAS $LOGFILE - su -c "$0 $*" $RUNAS - exit 0 -fi - # Proxy CWD is here. Should be writable by it. -DIR=/var/proxy +DIR=/var/yaz-proxy # Proxy Path DAEMON=/usr/local/bin/yaz-proxy # Proxy PIDFILE. Must be writable by it. -PIDFILE=$DIR/proxy.pid +PIDFILE=$DIR/yaz-proxy.pid +# Log file +LOGFILE=/var/log/yaz-proxy.log # Port PORT=9000 +# Run as this user. Set to empty to keep uid as is +RUNAS=nobody +RUNAS= # Extra args . Config file _WITH_ option ARGS="-c config.xml" +if test -n "RUNAS"; then + ARGS="-u $RUNAS $ARGS" +fi + # Name, Description (not essential) NAME=yaz-proxy DESC="YAZ proxy" @@ -54,6 +53,7 @@ case "$1" in if test -f $PIDFILE; then kill `cat $PIDFILE` + rm -f $PIDFILE echo "$NAME." else echo "No PID $PIDFILE" @@ -68,6 +68,7 @@ case "$1" in echo -n "Restarting $DESC: " if test -f $PIDFILE; then kill `cat $PIDFILE` + rm -f $PIDFILE fi sleep 1 cd $DIR