Roxen.git / server / start

version» Context lines:

Roxen.git/server/start:1:   #!/bin/sh   # - # $Id: start,v 1.130 2000/10/02 16:34:00 jonasw Exp $ + # $Id: start,v 1.131 2000/11/16 10:58:06 per Exp $      ### If --silent-start is given as the first argument,   ### nothing will be printed to stdout by the script.      if [ "x$1" = "x--silent-start" ]   then    SILENT_START="y"    shift   fi      pre="`echo \" \" | sed -e 's/\(.........\)\(.*\)/\1/g'` :"      dp() {    if [ "x$SILENT_START" = "xy" ]    then :; else    echo "$pre" "$@" 2>&1    fi   }    -  +  + change_owner( ) { +  uid="$1"; shift +  gid="$1"; shift +  +  for a in "$@" ; do +  ok=`ls -lgd $a 2>/dev/null | grep $uid | grep $gid | wc -l` +  ok=`echo $ok` +  if [ x$ok = x1 ] ; then +  dp "$a already has the correct ownership" +  else +  dp "Changing ownership of $a to $uid:$gid" +  if chown -R "$uid" "$a" 2>/dev/null ; then +  if chgrp -R "$gid" "$a" 2>/dev/null ; then +  : +  else +  dp "Group change failed" +  fi +  else +  dp "Ownership change failed" +  fi +  fi +  done + } +  +  + check_owner() { +  uid=`$pike -e 'write("%d",getuid())'` +  gargs='' +  +  if [ x"$uid" = x0 ] ; then +  # Shall we change uid/gid? +  num=`grep --help 2>&1|grep gnu|wc -l` +  num=`echo $num` +  if [ x"$num" = x1 ] ; then +  gargs='-a' +  fi +  ugid=`grep $gargs "='User'>" $DIR/Global_Variables 2>/dev/null\ +  | sed -e 's/.*<str>//' -e 's,</str>.*,,'` +  if [ ! x$ugid = x ] ; then +  dp "Doing uid change to $ugid" +  oifs="$IFS";IFS=':';set $ugid;IFS="$oifs" +  change_owner $1 $2 $DIR $VARDIR $LOGDIR +  ok=`ls -lgd $a 2>/dev/null | grep $2 |wc -l` +  ok=`echo $ok` +  if [ "x$ok" = x1 ] ; then +  dp ". is already readable by $2" +  else +  chgrp -R "$2" . +  chmod -R g+w . +  fi +  fi +  fi + } +  +    # Breaks on linux when using symlinks.   dn="`dirname $0`"   case "$dn" in    ""|".")    ;;    *)    dp "Changing current directory to '$dn' (now `pwd`)"    cd $dn    dp "Got new directory as `pwd`"    ;;
Roxen.git/server/start:173:    --log-dir=*)    LOGDIR=`echo $1 | sed -e 's/--log-dir=//'`    ;;    --config-dir=*)    DIR=`echo $1 | sed -e 's/--config-dir=//'`    FILES=`echo $1 | sed -e's/--config-dir=//' -e's/\.//g' -e's./..g' -e 's.-..g'`    ;;    --pid-file=*)    extra_args="$extra_args $1"    ;; +  '--with-security'|'--enable-security') +  DEFINES="$DEFINES -DSECURITY" +  ;; +     '--debug'|'--with-debug'|'--enable-debug')    debug=1    ;;    '--without-debug')    debug=-1    ;;    '--fd-debug'|'--with-fd-debug'|'--enable-fd-debug')    DEFINES="-DFD_DEBUG $DEFINES"    ;;    '--without-ram-cache'|'--disable-ram-cache')
Roxen.git/server/start:313:    .B--with-profileB.: Store runtime profiling information on    a directory basis. This information is    not saved on permanent storage, it is only    available until the next server restart    This will enable a new 'action' in the    administration interface       .B--with-file-profileB.: Like .B--with-profileB., but save information    for each and every file.    -  .B--with-keep-aliveB.: Enable keep alive in the HTTP -  protocol module. This is the default. -  Some clients might have problems -  with keep-alive. -  -  .B--without-keep-aliveB.: Disable keep alive in the HTTP -  protocol module. Some clients might have -  problems with keep-alive. -  +     .B--onceB.: Run the server only once, in the foreground.    This is very useful when debugging.       .B--gdbB.: Run the server in gdb. Implies .B--onceB..       .B--programB.: Start a different program with the roxen    Pike. As an example,    .B./start --program bin/install.pikeB. will    start the installation program normally    started with .B./installB.
Roxen.git/server/start:571:    kill $ROXEN_PID 2>/dev/null    while kill -0 $ROXEN_PID 2>/dev/null; do    sleep 1    done    fi    dp "Roxen WebServer shutdown."    exit 0   }      start_roxen() { +  check_owner    if [ x$remove_dumped = x1 ] ; then    remove_old_dot_o_files "user request"    fi    if [ "x$DIR" != "x../configurations/" ] ; then    args="$DEFINES $ARGS $program --config-dir=$DIR $pass"    else    args="$DEFINES $ARGS $program $pass"    fi    if [ x$cd_to != x ] ; then    cd $cd_to
Roxen.git/server/start:629:    gdb $pike    fi    rm .gdbinit    fi   }         #   # Now do the stuff   # - PIKEVERSION="`$pike --version 2>&1`" + PIKEVERSION="`$pike --version 2>&1|head -1`"   LS="`ls -lL $pike 2>/dev/null`"    -  + VERSION_DATA="$PIKEVERSION $DEFINES $LS" +    if [ "$program" = "base_server/roxenloader.pike" ] ; then -  if [ "`cat $old_roxen_defines 2>/dev/null`" != "$PIKEVERSION $DEFINES $LS" ] ; then +  if [ "`cat $old_roxen_defines 2>/dev/null`" != "$VERSION_DATA" ] ; then    remove_old_dot_o_files "defines or pike version changed"    fi -  echo "$PIKEVERSION $DEFINES $LS" > $old_roxen_defines +  echo "$VERSION_DATA" > $old_roxen_defines   fi      if [ -z "$once" ] ; then    if [ $verbose -gt 0 ]; then    dp "Starting the Roxen WebServer."    else :; fi    ./mkdir -p $LOGDIR/debug/       if [ $verbose -gt 0 ]; then    dp "Using configuration from $DIR, storing the debug log in $LOGDIR/debug/$FILES.1."