Skip to content
Snippets Groups Projects
start.sh 510 B
Newer Older
  • Learn to ignore specific revisions
  • #!/bin/sh
    appname="$1"
    script="${2:-${appname}}"
    
    Stuart Gathman's avatar
    Stuart Gathman committed
    datadir="/var/lib/milter"
    logdir="/var/log/milter"
    
    Stuart Gathman's avatar
    Stuart Gathman committed
    piddir="/var/run/milter"
    libdir="/usr/lib/pymilter"
    
    Stuart Gathman's avatar
    Stuart Gathman committed
    python="python2.4"
    
    Stuart Gathman's avatar
    Stuart Gathman committed
    exec >>${logdir}/${appname}.log 2>&1
    
    if test -s ${datadir}/${script}.py; then
    
    Stuart Gathman's avatar
    Stuart Gathman committed
      cd ${datadir} # use version in data dir if it exists for debugging
    elif test -s ${logdir}/${script}.py; then
      cd ${logdir} # use version in log dir if it exists for debugging
    
    Stuart Gathman's avatar
    Stuart Gathman committed
      cd ${libdir}
    
    ${python} ${script}.py &
    
    Stuart Gathman's avatar
    Stuart Gathman committed
    echo $! >${piddir}/${appname}.pid