Loading ...
Sorry, an error occurred while loading the content.

Unslung init scripts - making your own

Expand Messages
  • Tim Walker
    I ve started compiling the occasional application on Unslung, and was wondering how to write my own init scripts to go in /opt/etc/init.d/ - i.e. the ones
    Message 1 of 6 , Dec 27, 2006
    • 0 Attachment
      I've started compiling the occasional application on Unslung, and was
      wondering how to write my own init scripts to go in /opt/etc/init.d/ -
      i.e. the ones which are named something like 'S80thttpd'. (I'm
      specifically interested in making two scripts for LCDd/lcdproc - see
      my earlier post
      (http://tech.groups.yahoo.com/group/nslu2-linux/message/16714) for the
      background to this.)

      Adapted from the Fuppes HOWTO, here are the two scripts I've made so far:
      ---
      S94LCDd:

      NAME=LCDd DAEMON=/opt/sbin/LCDd PIDFILE=/opt/var/run/$NAME.pid

      if [ -n "`pidof $NAME`" ] ; then

      echo "Stopping $NAME:"
      killall $NAME

      else

      echo "Starting $NAME:"
      $DAEMON &

      fi
      ---
      S95lcdproc:

      [as above, but with 'lcdproc' replacing 'LCDd', and the daemon is in
      /opt/bin/]
      ---
      There are two questions which are on my mind at this stage:

      - I named the scripts on the assumption that the 'S number' in the
      name affects the order in which the scripts are executed. Am I
      correct, and if so, would anyone suggest more appropriate numbers, in
      case LCDd and lcdproc need to be running before/after anything else?

      - Can anyone spot any potential problems with the scripts themselves?
      (I know the binaries' locations are correct, but I may be missing
      something else for all I know.)

      Many thanks in advance for any suggestions on the above, or indeed my
      earlier post if anyone has something to add. Anything I learn from the
      above will go into the HOWTO I hope to produce for installing a
      Pertelian X2040 LCD display on Unslung (my earlier post would form the
      first part). I've just ordered the Pertelian today, so when I have it
      I hope to update you on how I get on with adding it to my slug (if it
      ends up possible at all on Unslung, naturally).

      Happy New Year to everyone on the list!

      Best regards,
      Tim.
    • Rod Whitby
      Would you like to become an Optware developer so you can commit your additions to the repository? Your scripts look fine, and your assumption about the numbers
      Message 2 of 6 , Dec 30, 2006
      • 0 Attachment
        Would you like to become an Optware developer so you can commit your additions to the repository?
        Your scripts look fine, and your assumption about the numbers is correct.
        -- Rod

        -----Original Message-----
        From: "Tim Walker" <tawalker2@...>
        Date: Thursday, Dec 28, 2006 9:43 am
        Subject: [nslu2-linux] Unslung init scripts - making your own

        I've started compiling the occasional application on Unslung, and was
        wondering how to write my own init scripts to go in /opt/etc/init.d/ - i.e. the ones which are named something like 'S80thttpd'. (I'm
        specifically interested in making two scripts for LCDd/lcdproc - see
        my earlier post
        (http://tech.groups.yahoo.com/group/nslu2-linux/message/16714) for the background to this.)

        Adapted from the Fuppes HOWTO, here are the two scripts I've made so far:
        ---
        S94LCDd:

        NAME=LCDd DAEMON=/opt/sbin/LCDd PIDFILE=/opt/var/run/$NAME.pid

        if [ -n "`pidof $NAME`" ] ; then

        echo "Stopping $NAME:"
        killall $NAME

        else

        echo "Starting $NAME:"
        $DAEMON &

        fi
        ---
        S95lcdproc:

        [as above, but with 'lcdproc' replacing 'LCDd', and the daemon is in
        /opt/bin/]
        ---
        There are two questions which are on my mind at this stage:

        - I named the scripts on the assumption that the 'S number' in the
        name affects the order in which the scripts are executed. Am I
        correct, and if so, would anyone suggest more appropriate numbers, in case LCDd and lcdproc need to be running before/after anything else?

        - Can anyone spot any potential problems with the scripts themselves?
        (I know the binaries' locations are correct, but I may be missing
        something else for all I know.)

        Many thanks in advance for any suggestions on the above, or indeed my earlier post if anyone has something to add. Anything I learn from the above will go into the HOWTO I hope to produce for installing a
        Pertelian X2040 LCD display on Unslung (my earlier post would form the first part). I've just ordered the Pertelian today, so when I have it I hope to update you on how I get on with adding it to my slug (if it ends up possible at all on Unslung, naturally).

        Happy New Year to everyone on the list!

        Best regards,
        Tim.




        Yahoo! Groups Links
      • Marcel Nijenhof
        ... 1) I would at #!/bin/sh on the first line. 2) I am not sure if your daemon writes to stdout or stderr. In that case everything is written to a serial line
        Message 3 of 6 , Dec 30, 2006
        • 0 Attachment
          On Wed, 2006-12-27 at 23:13 +0000, Tim Walker wrote:

          > NAME=LCDd DAEMON=/opt/sbin/LCDd PIDFILE=/opt/var/run/$NAME.pid
          >
          > if [ -n "`pidof $NAME`" ] ; then
          >
          > echo "Stopping $NAME:"
          > killall $NAME
          >
          > else
          >
          > echo "Starting $NAME:"
          > $DAEMON &
          >
          > fi
          >
          > ....
          >
          > - Can anyone spot any potential problems with the scripts themselves?
          > (I know the binaries' locations are correct, but I may be missing
          > something else for all I know.)

          1) I would at #!/bin/sh on the first line.
          2) I am not sure if your daemon writes to stdout or stderr.
          In that case everything is written to a serial line which in
          most cases isn't connected at all. Maybe that output should
          be saved somewhere.

          --
          marceln
        • Tim Walker
          Thanks Marcel - don t know how I missed the shebang (#!/bin/sh) at the start. I should have also looked at the other init scripts in /opt/etc/init.d/, which
          Message 4 of 6 , Jan 1, 2007
          • 0 Attachment
            Thanks Marcel - don't know how I missed the 'shebang' (#!/bin/sh) at
            the start. I should have also looked at the other init scripts in
            /opt/etc/init.d/, which would have shown me this. Sadly, I don't write
            many shell scripts these days, so this may be why I'd forgotten this
            was a good way to start them :-)

            I'll look again at the other init scripts for more good ideas, and
            post the revised ones for LCDd and lcdproc here when they're ready.

            Thanks again for your help - BTW, I'm expecting the Pertelian display
            to arrive tomorrow, so I should be able to report back here on
            progress in a couple of days.

            Much appreciated,
            Tim

            --- In nslu2-linux@yahoogroups.com, Marcel Nijenhof <nslu2@...> wrote:
            >
            > On Wed, 2006-12-27 at 23:13 +0000, Tim Walker wrote:
            >
            > > NAME=LCDd DAEMON=/opt/sbin/LCDd PIDFILE=/opt/var/run/$NAME.pid
            > >
            > > if [ -n "`pidof $NAME`" ] ; then
            > >
            > > echo "Stopping $NAME:"
            > > killall $NAME
            > >
            > > else
            > >
            > > echo "Starting $NAME:"
            > > $DAEMON &
            > >
            > > fi
            > >
            > > ....
            > >
            > > - Can anyone spot any potential problems with the scripts themselves?
            > > (I know the binaries' locations are correct, but I may be missing
            > > something else for all I know.)
            >
            > 1) I would at #!/bin/sh on the first line.
            > 2) I am not sure if your daemon writes to stdout or stderr.
            > In that case everything is written to a serial line which in
            > most cases isn't connected at all. Maybe that output should
            > be saved somewhere.
            >
            > --
            > marceln
            >
          • Tim Walker
            Hi Rod, Happy New Year to you (and to everyone else here)... just getting back into normal routine after Christmas :-) ... additions to the repository? ...
            Message 5 of 6 , Jan 1, 2007
            • 0 Attachment
              Hi Rod,

              Happy New Year to you (and to everyone else here)... just getting back
              into normal routine after Christmas :-)

              --- In nslu2-linux@yahoogroups.com, "Rod Whitby" <rod@...> wrote:
              >
              > Would you like to become an Optware developer so you can commit your
              additions to the repository?
              > Your scripts look fine, and your assumption about the numbers is
              correct.
              > -- Rod

              Thanks for your (and Marcel's) feedback on the scripts - I'm going to
              adjust them a bit, and post the updated ones here in due course. I'd
              be happy to help further if I can - Unslung is a great project, and
              I'dlike to give something back to the community in return for giving
              me a whole new network server...

              I'm expecting delivery of the Pertelian display any day now (hopefully
              tomorrow, Jan 2nd), so would it be OK with you if I make sure I can
              get it working, then come back here and let you all know how (if?) it
              worked? If all is well, I'd be glad to try packaging up lcdproc for
              Unslung, if it's something I'd be able to do.

              Only thing is, I'm not really a programmer-sort of developer - I'm
              fairly comfortable with the basics of compiling an application from
              source (including some config options), but have never written
              anything more than a few bash and PHP scripts, and haven't used SVN or
              systems like that. Having said that, if creating packages isn't that
              difficult, I'm happy to give it a go, at least for lcdproc.

              Is this the wiki entry on creating Optware packages?

              http://www.nslu2-linux.org/wiki/Optware/AddAPackageToOptware

              (BTW: I compiled v0.5.0 of lcdproc - the latest is v0.5.1 - as it
              looks from the changelog as if the HD44780/lcdserializer driver which
              the Pertelian display needs, has been removed from 0.5.1. I'll see if
              this one works for me, and go from there.)

              Thanks again,
              Tim.

              > -----Original Message-----
              > From: "Tim Walker" <tawalker2@...>
              > Date: Thursday, Dec 28, 2006 9:43 am
              > Subject: [nslu2-linux] Unslung init scripts - making your own
              >
              > I've started compiling the occasional application on Unslung, and was
              > wondering how to write my own init scripts to go in /opt/etc/init.d/
              - i.e. the ones which are named something like 'S80thttpd'. (I'm
              > specifically interested in making two scripts for LCDd/lcdproc - see
              > my earlier post
              > (http://tech.groups.yahoo.com/group/nslu2-linux/message/16714) for
              the background to this.)
              >
              > Adapted from the Fuppes HOWTO, here are the two scripts I've made so
              far:
              > ---
              > S94LCDd:
              >
              > NAME=LCDd DAEMON=/opt/sbin/LCDd PIDFILE=/opt/var/run/$NAME.pid
              >
              > if [ -n "`pidof $NAME`" ] ; then
              >
              > echo "Stopping $NAME:"
              > killall $NAME
              >
              > else
              >
              > echo "Starting $NAME:"
              > $DAEMON &
              >
              > fi
              > ---
              > S95lcdproc:
              >
              > [as above, but with 'lcdproc' replacing 'LCDd', and the daemon is in
              > /opt/bin/]
              > ---
              > There are two questions which are on my mind at this stage:
              >
              > - I named the scripts on the assumption that the 'S number' in the
              > name affects the order in which the scripts are executed. Am I
              > correct, and if so, would anyone suggest more appropriate numbers,
              in case LCDd and lcdproc need to be running before/after anything else?
              >
              > - Can anyone spot any potential problems with the scripts themselves?
              > (I know the binaries' locations are correct, but I may be missing
              > something else for all I know.)
              >
              > Many thanks in advance for any suggestions on the above, or indeed
              my earlier post if anyone has something to add. Anything I learn from
              the above will go into the HOWTO I hope to produce for installing a
              > Pertelian X2040 LCD display on Unslung (my earlier post would form
              the first part). I've just ordered the Pertelian today, so when I have
              it I hope to update you on how I get on with adding it to my slug (if
              it ends up possible at all on Unslung, naturally).
              >
              > Happy New Year to everyone on the list!
              >
              > Best regards,
              > Tim.
              >
              >
              >
              >
              > Yahoo! Groups Links
              >
            • Rod Whitby
              ... Yes, and you don t need much more than the skills you already have to contribute a package. -- Rod
              Message 6 of 6 , Jan 1, 2007
              • 0 Attachment
                Tim Walker wrote:
                > Only thing is, I'm not really a programmer-sort of developer - I'm
                > fairly comfortable with the basics of compiling an application from
                > source (including some config options), but have never written
                > anything more than a few bash and PHP scripts, and haven't used SVN or
                > systems like that. Having said that, if creating packages isn't that
                > difficult, I'm happy to give it a go, at least for lcdproc.
                >
                > Is this the wiki entry on creating Optware packages?
                >
                > http://www.nslu2-linux.org/wiki/Optware/AddAPackageToOptware

                Yes, and you don't need much more than the skills you already have to
                contribute a package.

                -- Rod
              Your message has been successfully submitted and would be delivered to recipients shortly.