Roxen.git / server / start

version» Context lines:

Roxen.git/server/start:1:   #!/bin/sh   # - # $Id: start,v 1.132 2000/11/11 04:27:06 nilsson Exp $ + # $Id: start,v 1.133 2000/11/16 10:56:19 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:585:    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