Changes

Jump to navigation Jump to search
Line 34: Line 34:  
  echo 'Starting service…' >&2
 
  echo 'Starting service…' >&2
 
   local CMD="$SCRIPT &> \"$LOGFILE\" & echo \$!"
 
   local CMD="$SCRIPT &> \"$LOGFILE\" & echo \$!"
   su -c "$CMD" $RUNAS > "$PIDFILE"
+
   su -s /bin/sh $RUNAS -c "$CMD" > "$PIDFILE"
 +
 +
# Try with this command line instead of above if not workable
 +
# su -c "$CMD" $RUNAS > "$PIDFILE"
 +
 +
  sleep 2
 +
  PID=$(cat $PIDFILE)
 
     if pgrep -u $RUNAS -f $NAME > /dev/null
 
     if pgrep -u $RUNAS -f $NAME > /dev/null
 
     then
 
     then
       echo "$NAME is now running."
+
       echo "$NAME is now running, the PID is $PID"
 
     else
 
     else
 
       echo "Error! Could not start $NAME!"
 
       echo "Error! Could not start $NAME!"
 
     fi
 
     fi
 +
 
  }
 
  }
 
   
 
   
Line 53: Line 60:  
  }
 
  }
 
   
 
   
uninstall() {
+
   status() {
   echo -n "Are you really sure you want to uninstall this service? That cannot be undone. [yes|No] "
  −
  local SURE
  −
  read SURE
  −
  if [ "$SURE" = "yes" ]; then
  −
stop
  −
    rm -f "$PIDFILE"
  −
    echo "Notice: log file is not be removed: '$LOGFILE'" >&2
  −
    update-rc.d -f <NAME> remove
  −
    rm -fv "$0"
  −
  fi
  −
}
  −
  −
status() {
   
         printf "%-50s" "Checking $NAME..."
 
         printf "%-50s" "Checking $NAME..."
 
     if [ -f $PIDFILE ]; then
 
     if [ -f $PIDFILE ]; then
Line 90: Line 84:  
   status)
 
   status)
 
     status
 
     status
    ;;
  −
  uninstall)
  −
    uninstall
   
     ;;
 
     ;;
 
   restart)
 
   restart)
Line 99: Line 90:  
     ;;
 
     ;;
 
   *)
 
   *)
     echo "Usage: $0 {start|stop|status|restart|uninstall}"
+
     echo "Usage: $0 {start|stop|status|restart}"
 
  esac
 
  esac
   Line 116: Line 107:  
  chmod u+x /etc/rc.d/init.d/YOUR_SERVICE_NAME
 
  chmod u+x /etc/rc.d/init.d/YOUR_SERVICE_NAME
    +
====optional chkconfig====
 
You need to say to SME Server to add the script to each run level you have specified at the top of your init script( Default-Start: 2 3 4 5 and Default-Stop: 0 1 6 ). For Linux using rpm as centos or redhat, you can use
 
You need to say to SME Server to add the script to each run level you have specified at the top of your init script( Default-Start: 2 3 4 5 and Default-Stop: 0 1 6 ). For Linux using rpm as centos or redhat, you can use
   Line 200: Line 192:  
  db configuration setprop <servicename> UDPPorts <portnumbers> # Ranges of ports are defined with a : not a -
 
  db configuration setprop <servicename> UDPPorts <portnumbers> # Ranges of ports are defined with a : not a -
 
  db configuration setprop <servicename> status enabled|disabled
 
  db configuration setprop <servicename> status enabled|disabled
  db configuration setprop <servicename> access public|private
+
  db configuration setprop <servicename> access public|private|localhost
 
  db configuration setprop <servicename> AllowHosts a.b.c.d,x.y.z.0/24
 
  db configuration setprop <servicename> AllowHosts a.b.c.d,x.y.z.0/24
 
  db configuration setprop <servicename> DenyHosts e.f.g.h,l.m.n.0/24
 
  db configuration setprop <servicename> DenyHosts e.f.g.h,l.m.n.0/24
Line 226: Line 218:  
{{tip box|you may use TAB to auto-complete your command line}}
 
{{tip box|you may use TAB to auto-complete your command line}}
   −
 
+
you have some shortcuts
 +
down => 'd',
 +
stop => 'd',
 +
up => 'u',
 +
start => 'u',
 +
restart => 't',
 +
sigterm => 't',
 +
adjust => 'h',
 +
reload => 'h',
 +
sighup => 'h',
 +
sigusr1 => '1',
 +
sigusr2 => '2',
 +
once => 'o',
 +
pause => 'p',
 +
alarm => 'a',
 +
interrupt => 'i',
 +
quit => 'q',
 +
kill => 'k',
 +
exit => 'x',
    
====Example====  
 
====Example====  

Navigation menu