Announcement

Collapse
No announcement yet.

Starting Shoutcast on Boot up

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Starting Shoutcast on Boot up

    Hi, I have done lots of searching both in this forum and on the web for a sample on how to start my shoutcast server when my unix server reboots instead of I always having to SH into the server and start it up manually.

    I did find a mac and something at the following link but its not working. http://forums.theplanet.com/index.ph...pic=13540&st=0

    Can anyone point me to a topic some where which deals with this subject or a sample script?

    Many Thanks

  • #2
    please delete
    greets,
    Michael

    TechnoBase.FM | HouseTime.FM | HardBase.FM | TranceBase.FM | CoreTime.FM | We aRe oNe

    Comment


    • #3
      Step 1:
      Create a file named "shoutcast" with the following content in "/etc/init.d/" or
      download the attached file, rename, modify and copy it to "/etc/init.d/" (Full path "/etc/init.d/shoutcast"):

      code:
      #!/bin/sh
      #
      # Sample init script for SHOUTcast
      # by caraoge
      #

      # Check for SHOUTcast binary
      test -f /caraoge/sc_serv || exit 0

      # The init commands
      case "$1" in
      start)
      echo "Starting SHOUTcast server..."
      /caraoge/sc_serv /caraoge/sc_serv.conf &
      ;;
      stop)
      echo "Stopping SHOUTcast server..."
      kill -9 `ps -C sc_serv -o pid --no-headers`
      ;;
      restart)
      echo "Stopping SHOUTcast server..."
      kill -9 `ps -C sc_serv -o pid --no-headers`
      echo "Starting SHOUTcast server..."
      /caraoge/sc_serv /caraoge/sc_serv.conf &
      ;;
      *)
      echo "usage: /etc/init.d/shoutcast"
      echo "$0 {start | stop | restart}"
      exit 1
      ;;
      esac

      Note: You have to edit the path to your SHOUTcast binary and your configuration file


      Step 2:
      Now you have to make the file executable:
      code:
      chmod 755 /etc/init.d/shoutcast
      Step 3:
      Create the startup scripts with (Debian!):
      code:
      update-rc.d shoutcast defaults
      Step 4:
      Now your SHOUTcast server starts up everytime your server pass through its startup sequence.
      If your server is running, you can use
      code:
      /etc/init.d/shoutcast start
      or
      code:
      /etc/init.d/shoutcast stop
      or
      code:
      /etc/init.d/shoutcast restart
      to control your SHOUTcast server.

      Removing the SHOUTcast server from the startup sequence:
      Type this on your command line:
      code:
      update-rc.d -f shoutcast remove
      Attached Files
      greets,
      Michael

      TechnoBase.FM | HouseTime.FM | HardBase.FM | TranceBase.FM | CoreTime.FM | We aRe oNe

      Comment


      • #4
        Hi Garaoge, Many THANKS for the quick response and the script.

        When I run this command: "update-rc.d shoutcast defaults" I get the error message: bash: update-rc.d: command not found.

        However, when I run "/etc/init.d/shoutcast start" the server starts.

        What should I be looking for?

        Thanks

        Fred

        Comment


        • #5
          the following will start up services on boot, and will restart if it fails or crashes. ive tested this on freebsd 6 and 7, centos, macosx

          a script that checks to see if the sc_serv is running, if it isnt, start it.

          Create a file. name it whatever.. i call mine sc_mon.sh

          put the following in it:
          code:

          #!/bin/sh
          #!/usr/bin/perl



          ### Shoutcast (SC_SERV)


          ## SC_SERV Server 1
          if
          ( ! ps auxwww | grep "/home/user/sc_serv/sc_serv /home/user/sc_serv/sc_serv.conf" | grep -v grep )
          then echo "Shoutcast not running..."
          /home/user/sc_serv/sc_serv /home/user/sc_serv/sc_serv.conf &
          fi

          save and close the file

          chmod 777 sc_mon.sh

          setup a cron job to run this script every 60 secs... mine looks like this:

          */1 * * * * /home/user/sc_serv/sc_mon.sh >> /dev/null 2>&1

          this will execute the script every 60 secs to check if shoutcast is running and will start it if its not.

          cheers

          DopeLabs

          Comment


          • #6
            Hi dopelabs, Many THANKS, this script sure works. It was a headache for me having to manually restart my shoutcast server.

            I running Unix


            Again Thanks

            Fred

            Comment


            • #7
              Its now 2018 and this won't work on centOS
              remove " | grep -v grep " and it seems to work now for anyone in the future

              Comment


              • #8
                Originally Posted by AusFreak View Post
                Its now 2018 and this won't work on centOS
                remove " | grep -v grep " and it seems to work now for anyone in the future
                Thanks!
                I listen to 80's music every day on the JOB (http://traefaeldning.dk/).

                Comment


                • #9
                  Originally Posted by AusFreak View Post
                  Its now 2018 and this won't work on centOS
                  remove " | grep -v grep " and it seems to work now for anyone in the future
                  you do not want to do this as it will create a false positive and will always try to start shoutcast... even if its already running...

                  the idea is only try to start IF its not running.

                  when the script checks the list of running processes

                  code:
                  ps auxwww | grep "/home/user/sc_serv/sc_serv /home/user/sc_serv/sc_serv.conf"
                  if sc_serv is running it will return 2 lines, one line that matches the sc_serv process
                  and one line that matches the ps auxwww command that you just executed.

                  if sc_serv is not running, it will return only the ps command you just executed, both resulting in a 'true' result.

                  the script has a ! at the beginning which means do something if there are no results or 'false' result.


                  if sc_serv is NOT running, then run it... and the only way it can tell if its NOT running is if you run

                  code:
                  ! ps auxwww | grep "/home/user/sc_serv/sc_serv /home/user/sc_serv/sc_serv.conf" | grep -v grep
                  the grep -v grep ensures that when running ps, it will not return itself as a running process...

                  i hope that makes sense..

                  Comment


                  • #10
                    startup help

                    hi i have installed steamcast but i was going to follow the script that i have on here but i have put it under a diffrent username how do i change the script to start it under a diffrent username

                    Comment


                    • #11
                      login with the different username and follow the same instructions

                      Comment


                      • #12
                        Originally Posted by caraoge View Post
                        Step 1:
                        Create a file named "shoutcast" with the following content in "/etc/init.d/" or
                        download the attached file, rename, modify and copy it to "/etc/init.d/" (Full path "/etc/init.d/shoutcast"):

                        code:
                        #!/bin/sh
                        #
                        # Sample init script for SHOUTcast
                        # by caraoge
                        #

                        # Check for SHOUTcast binary
                        test -f /caraoge/sc_serv || exit 0

                        # The init commands
                        case "$1" in
                        start)
                        echo "Starting SHOUTcast server..."
                        /caraoge/sc_serv /caraoge/sc_serv.conf &
                        ;;
                        stop)
                        echo "Stopping SHOUTcast server..."
                        kill -9 `ps -C sc_serv -o pid --no-headers`
                        ;;
                        restart)
                        echo "Stopping SHOUTcast server..."
                        kill -9 `ps -C sc_serv -o pid --no-headers`
                        echo "Starting SHOUTcast server..."
                        /caraoge/sc_serv /caraoge/sc_serv.conf &
                        ;;
                        *)
                        echo "usage: /etc/init.d/shoutcast"
                        echo "$0 {start | stop | restart}"
                        exit 1
                        ;;
                        esac

                        Note: You have to edit the path to your SHOUTcast binary and your configuration file


                        Step 2:
                        Now you have to make the file executable:
                        code:
                        chmod 755 /etc/init.d/shoutcast
                        Step 3:
                        Create the startup scripts with (Debian!):
                        code:
                        update-rc.d shoutcast defaults
                        Step 4:
                        Now your SHOUTcast server starts up everytime your server pass through its startup sequence.
                        If your server is running, you can use
                        code:
                        /etc/init.d/shoutcast start
                        or
                        code:
                        /etc/init.d/shoutcast stop
                        or
                        code:
                        /etc/init.d/shoutcast restart
                        to control your SHOUTcast server.

                        Removing the SHOUTcast server from the startup sequence:
                        Type this on your command line:
                        code:
                        update-rc.d -f shoutcast remove
                        I have ubuntu 20.04.
                        This solution doesn't work for me.
                        commands works (/etc/init.d/shoutcast start) but it doesn't start Shoutcast after reboot.
                        Please tell me how I can make Shoutcast run automatically after reboot.
                        Thanks

                        Comment

                        Working...
                        X
                        😀
                        🥰
                        🤢
                        😎
                        😡
                        👍
                        👎