Find the answer to your Linux question:
Results 1 to 2 of 2
hi, I have following init script which works fine when i trigger it manually but doesn't start my python script on bootup, why not? I put it in /etc/init.d/ and ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jun 2010
    Location
    Planet Earth
    Posts
    18

    Question [BusyBox] init script


    hi,

    I have following init script which works fine when i trigger it manually but doesn't start my python script on bootup, why not? I put it in /etc/init.d/ and called it S99gateway

    Code:
    # cat /etc/init.d/S95gateway 
    #!/bin/sh
    #
    start() {
            echo 'Starting SemiosNET gateway'
            /usr/bin/python /root/gateway.py > /dev/null &
    }
    stop() {
            echo 'stopping SemiosNET gateway'
            killall -KILL python
    }
    ### main logic ###
    case "$1" in
      start)
            start
            ;;
      stop)
            stop
            ;;
      status)
            status FOO
            ;;
      restart|reload|condrestart)
            stop
            start
            ;;
      *)
            echo $"Usage: $0 {start|stop|restart|reload|status}"
            exit 1
    esac
    exit 0
    Any clues or suggestions? Help is appreciated!
    Thank you!
    Ron

  2. #2
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,353
    is /usr not mounted yet?

    in the script, try output to a log file for later examination, e.g.:
    Code:
    /usr/bin/python /root/gateway.py > /tmp/gateway.log 2>&1 &
    if that is not it, then are you sure that the script is getting called (by rc.sysinit or whatever) with the "start" argument?

    as a test, you can do something like this, at the bottom of the script:

    Code:
      *)
    #       echo $"Usage: $0 {start|stop|restart|reload|status}"
    #        exit 1
    #testing...
      echo "No args given, but starting up anyway!"
      sleep 1
      start
      ;;
    esac

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •