Oct 092016
 
Advertisements

How to run dxspider as service.

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

#!/bin/sh
### BEGIN INIT INFO
# Provides:             dxspider
# Required-Start:       $all
# Required-Stop:        $all
# Default-Start:        2 3 5
# Default-Stop:         0 1 6
# Short-Description:    Dxspider
### END INIT INFO
#
# Created by SV5FRI
# Email: sv5fri@gmail.com
#
##############################
NAME=dxspider
DESC=dxspider

PID=`ps -A |grep perl|awk '{print $1}'`

set -e

pidfile=/spider/local/cluster.lck

. /lib/lsb/init-functions

RETVAL=0

# See how we were called.

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

  stop()
   {
        echo "Stopping DxSpider Server..."
        pkill -F  $pidfile
        RETVAL=$?
        [ $RETVAL -eq 0 ] && rm -f /var/lock/dxspider
        echo
        return $RETVAL
        }

  restart()
   {
       stop
       start
   }

case "$1" in
  start)
     start
  ;;

  stop)
    stop
  ;;

  restart)
    restart
  ;;
  status)
        if [ -f "$pidfile" ];
         then
                echo "Dxspider is running with pid: $PID"
         else
                echo "Dxspider is stopped..."
#        RETVAL=$?
      fi
  ;;

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

 

Change 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

Start dxspider

/etc/init.d/dxspider start

Stop dxspider

/etc/init.d/dxspider stop

Check if running dxspider

/etc/init.d/dxspider status

If you need help please contact with me

Good luck

 09/10/2016  Posted by at 3:56 pm Linux, Projects  Add comments

  9 Responses to “Run DxSpider as service on the Raspbian”

  1. Thank you for this excellent script. I tried it out and it does work, but I am not able to see spots when I start DXSpider as a service. I can log in to the console, but no spots appear.

    As a service is it loading the connect scripts?

    Thank you! 73 – Rich, K0PIR

  2. Trying to use it i have this error:

    root@raspberrypi:/etc/init.d# ./dxspider start
    [….] Starting dxspider (via systemctl): dxspider.serviceFailed to start dxspider.service: Unit dxspider.service failed to load: No such file or directory.
    failed!
    root@raspberrypi:/etc/init.d#

    Please…. could you help me?

    • Hello Ruben,

      Could you please give more details for your installation. Because from output error something is wrong with path (directory or file)

      Is possible to send the path where is the Dxspider installation

      73, de Yiannis, SV5FRI

      • Hi

        Also could you please check if exist following path’s

        /usr/bin/perl

        /spider/perl/cluster.pl

        also check if exist the Symbolic Link /spider if doesn’t exist please to create

        ln -s ~sysop/spider /spider

        Please check installation tutorial for Dxspider

        I will wait for your answer

        73, de Yiannis, SV5FRI

  3. Hello Yiannis,

    I am trying to get the dxspider up and running but I got stuck.
    DXspider does not startup as service.

    when I am running the script by hand root@raspberrypi:/etc/init.d/dxspider start I get the error
    /etc/init.d/dxspider: 24: /etc/init.d/dxspider: ./lib/lsb/init-functions: Permission denied

    The file is there
    root@raspberrypi:/etc/init.d# ls -l | grep dxspider
    -rwxr-xr-x 1 root root 1392 Aug 13 14:02 dxspider

    Do you have any idea what I am doing wrong here?
    I am running debian version 8.0

    I followed the instructions by the letter from k0pir and his youtube

    • Dear Johan,

      Sorry for late to answer you but just return from my vacation.

      could you please send me your script to checking

  4. Hello Yiannis

    The contents of the dxspider file.
    It is copy and pasted from the file into nano

    #!/bin/sh
    ### BEGIN INIT INFO
    # Provides: dxspider
    # Required-Start: $all
    # Required-Stop: $all
    # Default-Start: 2 3 5
    # Default-Stop: 0 1 6
    # Short-Description: Dxspider
    ### END INIT INFO
    #
    # Created by SV5FRI
    # Email: sv5fri@gmail.com
    #
    ##############################
    NAME=dxspider
    DESC=dxspider

    PID=`ps -A |grep perl|awk ‘{print $1}’`

    set -e

    pidfile=/spider/local/cluster.lck

    ./lib/lsb/init-functions

    RETVAL=0

    # See how we were called.

    start()
    {
    echo “Starting DxSpider Server…”
    /bin/su – sysop -c “/usr/bin/perl -w /spider/perl/cluster.pl” > /dev/tt$
    RETVAL=$?
    [ $RETVAL -eq 0 ] && touch /var/lock/dxspider
    echo
    return $RETVAL
    }

    stop()
    {
    echo “Stopping DxSpider Server…”
    pkill -F $pidfile
    RETVAL=$?
    [ $RETVAL -eq 0 ] && rm -f /var/lock/dxspider
    echo
    return $RETVAL
    }

    restart()
    {
    stop
    start
    }

    case “$1” in
    start)
    start
    ;;

    stop)
    stop
    ;;

    restart)
    restart
    ;;

    status)
    if [ -f “$pidfile” ];
    then
    echo “Dxspider is running with pid: $PID”
    else
    echo “Dxspider is stopped…”
    # RETVAL=$?
    fi
    ;;
    *)
    echo $”Usage: $0 {start|stop|restart|status}”
    exit $?
    ;;

    esac
    exit $?

  5. Could you please try to running the following script.
    If you have problem to running it please inform me and I will send to you the script via e-mail.

    #!/bin/sh
    ### BEGIN INIT INFO
    # Provides: dxspider
    # Required-Start: $all
    # Required-Stop: $all
    # Default-Start: 2 3 5
    # Default-Stop: 0 1 6
    # Short-Description: Dxspider
    ### END INIT INFO
    #
    # Create from Yiannis Panagou
    # Email: ypanagou@gmail.com
    #
    ##############################
    NAME=dxspider
    DESC=dxspider

    PID=`ps -A |grep perl|awk ‘{print $1}’`

    set -e

    pidfile=/spider/local/cluster.lck

    . /lib/lsb/init-functions

    RETVAL=0

    # See how we were called.

    start()
    {
    echo “Starting DxSpider Server…”
    /bin/su – sysop -c “/usr/bin/perl -w /spider/perl/cluster.pl” > /dev/tty3&
    RETVAL=$?
    [ $RETVAL -eq 0 ] && touch /var/lock/dxspider
    echo
    return $RETVAL
    }

    stop()
    {
    echo “Stopping DxSpider Server…”
    pkill -F $pidfile
    RETVAL=$?
    [ $RETVAL -eq 0 ] && rm -f /var/lock/dxspider
    echo
    return $RETVAL
    }

    restart()
    {
    stop
    start
    }

    case “$1” in
    start)
    start
    ;;

    stop)
    stop
    ;;

    restart)
    restart
    ;;
    status)
    if [ -f “$pidfile” ];
    then
    echo “Dxspider is running with pid: $PID”
    else
    echo “Dxspider is stopped…”
    # RETVAL=$?
    fi
    ;;

    *)
    echo $”Usage: $0 {start|stop|restart|status}”
    exit $?
    ;;
    esac
    exit $?

 Leave a Reply