Run DxSpider as service on the CentOS / RedHat / Fedora

How to run dxspider as service.

Create init script with name dxpider as root user in the below path /etc/init.d/

cd /etc/init.d/

touch dxspider

vi dxspider

Create script with name dxspider and like as below

#!/bin/sh
#
# chkconfig: 235 60 30
# description: Hamradio - DXSpider Cluster
# Created: 24 May 2012 by Yiannis Panagou, SV5FRI
# Vesrion: 1.1 - Last Modified: 29/07/2016
# Email: sv5fri@gmail.com
#
#
# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

pidfile=/spider/local/cluster.lck

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0

lockfile=/var/lock/subsys/dxspider

RETVAL=0

  start()
   {
   echo  "Starting DXSpider Server"
   /bin/su - sysop -c "/usr/bin/perl -w /spider/perl/cluster.pl" >/dev/tty7&
        RETVAL=$?
        [ $RETVAL -eq 0 ] && touch /var/lock/subsys/dxspider
        echo
        return $RETVAL
   }

  stop()
   {
   echo  "Stopping DXSpider Server"
        killproc /usr/bin/perl
        RETVAL=$?
        [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/dxspider
        echo
        return $RETVAL
        }

  restart()
   {
       stop
     sleep 5
       start
   }

case "$1" in
  start)
     start
  ;;

  stop)
    stop
  ;;

  restart)
    restart
  ;;
  status)
        status -p $pidfile DXSpider
        RETVAL=$?
  ;;

  *)
  echo $"Usage: $0 {start|stop|restart|status}"
        exit $?
        ;;
esac
exit $?
Change the permissions

chmod +x dxspider

Remove or disable line from /etc/inittab

DX:2345:respawn:/bin/su -c "/usr/bin/perl -w /spider/perl/cluster.pl" sysop >/dev/tty6

For start dx cluster

/etc/init.d/dxspider start

For stop dxspider

/etc/init.d/dxspider stop

For check if running dx cluster

/etc/init.d/dxspider status

If you need help please contact with me

Good luck 🙂

Share