ninjam_centos

Running Ninjam properly on CentOS

$ Wget .tar.gz
$ tar xvf
$ cd ninjam*/server
$ make
$ sudo cp ninjamsrv /usr/local/bin
/etc/init.d/ninjamsrv
#!/bin/sh
#
# chkconfig: 2345 25 90
#
# description: Ninjam is a jamming server (http://www.ninjam.com)
 
# Source function library
if [ -f /etc/init.d/functions ]; then
  . /etc/init.d/functions
elif [ -f /etc/rc.d/init.d/functions ]; then
  . /etc/rc.d/init.d/functions
else
  exit 0
fi
 
# Source networking configuration.
. /etc/sysconfig/network
 
# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0
 
# Path to the configuration file
NINJAMCONF=/etc/ninjamsrv.cfg
# Make sure that the ninjamsrv binary is in this path
PATH=/usr/local/sbin:$PATH
 
# This is our service name
BASENAME=$(basename $0)
if [ -L $0 ]; then
  BASENAME=$(find $0 -name $BASENAME -printf %l)
  BASENAME=$(basename $BASENAME)
fi
 
start() {
  echo -n $"Starting $BASENAME: "
  daemon $BASENAME $NINJAMCONF -setuid nobody -daemon > /dev/null
  RETVAL=$?
  [ $RETVAL -eq 0 ] && echo_success || echo_failure
  echo
  return $RETVAL
}
 
stop() {
  echo -n $"Shutting down $BASENAME: "
  killproc $BASENAME
  RETVAL=$?
  [ $RETVAL -eq 0 ] && echo_success || echo_failure
  echo
  return $RETVAL
}
 
restart() {
  echo -n $"Restarting $BASENAME: "
  stop
  start
  RETVAL=$?
  [ $RETVAL -eq 0 ] && echo_success || echo_failure
  echo
  return $RETVAL
}
 
reload() {
  echo -n $"Reloading $BASENAME: "
  killproc $BASENAME -HUP
  RETVAL=$?
  [ $RETVAL -eq 0 ] && echo_success || echo_failure
  echo
  return $RETVAL
}
condrestart() {
  [ -e /var/lock/subsys/$BASENAME ] && restart || :
}
 
 
RETVAL=0
 
# See how we were called.
case "$1" in
  start)
    start
    ;;
  stop)
    stop
    ;;
  restart)
    restart
    ;;
  reload)
    reload
    ;;
  condrestart)
    condrestart
    ;;
  status)
    status $BASENAME
    ;;
  *)
    echo $"Usage: $BASENAME {start|stop|restart|reload|condrestart|status}"
    RETVAL=1
esac
 
exit $RETVAL

Set three things as following, using default config and editing it :

ServerLicense /etc/ninjam-cclicense.txt
PIDFile /var/run/ninjamsrv.pid
LogFile /var/log/ninjamsrv.log
  • ninjam_centos.txt
  • Last modified: 2016/12/28 21:15
  • (external edit)