source: trunk/dports/databases/couchdb-devel/files/patch-plist_stdout_stderr.diff @ 47693

Last change on this file since 47693 was 47693, checked in by febeling@…, 11 years ago

databases/couchdb-devel: Fix logging, provide plist in LaunchDaemons.

  • use forground process controlled by launchd/upsteam plist
  • add stdout and stderr log file locations into plist
  • make bin/couchdb honour stdout and stderr path options
  • symlink plist into system location
File size: 2.4 KB
  • bin/couchdb.tpl.in

     
    222222                sleep $RESPAWN_TIMEOUT
    223223            done
    224224        else
    225             eval exec $command
     225            if test "$PID_FILE_GIVEN" = "true"; then
     226                PID_FLAG="-pidfile $PID_FILE"
     227            fi
     228            if test "$STDOUT_REDIR" = "true"; then
     229                STDOUT_DEST="> $STDOUT_FILE"
     230            fi
     231            if test "$STDERR_REDIR" = "true"; then
     232                STDERR_DEST="2> $STDERR_FILE"
     233            fi
     234            eval exec $command $PID_FLAG $STDOUT_DEST $STDERR_DEST
    226235        fi
    227236    fi
    228237}
     
    273282            -b) shift; BACKGROUND_BOOLEAN=true;;
    274283            -r) shift; RESPAWN_TIMEOUT=$1; shift;;
    275284            -R) shift; RECURSED_BOOLEAN=true;;
    276             -p) shift; PID_FILE=$1; shift;;
    277             -o) shift; STDOUT_FILE=$1; shift;;
    278             -e) shift; STDERR_FILE=$1; shift;;
     285            -p) shift; PID_FILE=$1; PID_FILE_GIVEN=true; shift;;
     286            -o) shift; STDOUT_FILE=$1; STDOUT_REDIR=true; shift;;
     287            -e) shift; STDERR_FILE=$1; STDERR_REDIR=true; shift;;
    279288            -s) shift; check_status; exit $SCRIPT_OK;;
    280289            -k) shift; KILL_BOOLEAN=true;;
    281290            -d) shift; SHUTDOWN_BOOLEAN=true;;
  • etc/Makefile.am

     
    5858        fi
    5959        sed -e "s|%configure_input%|$@. Generated from $< by configure.|" \
    6060            -e "s|%bindir%|$(bindir)|" \
     61            -e "s|%localstatelogdir%|$(localstatelogdir)|" \
    6162            -e "s|%couchdb_command_name%|$(couchdb_command_name)|" \
    6263        < $< > $@
    6364
  • etc/launchd/org.apache.couchdb.plist.tpl.in

     
    1515    <key>ProgramArguments</key>
    1616    <array>
    1717      <string>%bindir%/%couchdb_command_name%</string>
     18      <string>-o</string>
     19      <string>%localstatelogdir%/couchdb.stdout</string>
     20      <string>-e</string>
     21      <string>%localstatelogdir%/couchdb.stderr</string>
    1822    </array>
    1923    <key>UserName</key>
    2024    <string>couchdb</string>
Note: See TracBrowser for help on using the repository browser.