Run Steamcast as daemon

Steamcast is a stand alone server that combines the features of SHOUTcast and Icecast2 and more to make one mega awesome server.
Post Reply
User avatar
Flying Jack
Posts: 17
Joined: Mon Sep 25, 2006 4:36 am
Location: France
Contact:

Run Steamcast as daemon

Post by Flying Jack »

Hi !
I've juste set up a steamcast server, which runs fine, but I can't run it as daemon...
I've try with the same script I use for shoutcast, but it doesn't work...
Somebody has already do this ?
Thanks
Image
User avatar
Flying Jack
Posts: 17
Joined: Mon Sep 25, 2006 4:36 am
Location: France
Contact:

Post by Flying Jack »

found !
apt-get install screen

more /etc/init.d/steamcast
#!/bin/bash
screen -d -m /steamcast/steamcast /steamcast/steamcast.conf
Image
Lane
Posts: 154
Joined: Mon May 09, 2005 4:16 pm

Post by Lane »

do you really need screen? what about redirecting output

pathto/steamcast pathto/steamcast.conf > /dev/null
User avatar
Flying Jack
Posts: 17
Joined: Mon Sep 25, 2006 4:36 am
Location: France
Contact:

Post by Flying Jack »

Thanks a lot :)

I paste my script for everybody:

Code: Select all

server:/home/user# more /etc/init.d/steamcast
#!/bin/bash

NAME="Steamcast"

SRV_BIN=/steamcast/steamcast
SRV_CFG=/steamcast/steamcast.conf

# On va faire tourner steamcast en tant que nobody:nogroup
# On peut bien sur creer un autre user (sans shell,...) si on veut, bien sur
SRV_UID=nobody
SRV_GID=nogroup

SSD_BIN=/sbin/start-stop-daemon
SSD_GENERAL_OPTS="--quiet"

case "$1" in
  start)
        echo "Starting $NAME";
        $SSD_BIN $SSD_GENERAL_OPTS --chuid ${SRV_UID}:${SRV_GID} --user $SRV_UID \
                --group $SRV_GID --start --background --exec $SRV_BIN $SRV_CFG > /dev/null
        ;;
  stop)
        echo "Stopping $NAME";
        $SSD_BIN $SSD_GENERAL_OPTS --chuid ${SRV_UID}:${SRV_GID} --user $SRV_UID \
                --group $SRV_GID --stop --exec $SRV_BIN $SRV_CFG > /dev/null
        ;;
  restart|force-reload)
        echo "Restart";
        ;;
  *)
        echo "Usage: {start|stop|restart|force-reload}" >&2
        exit 1
        ;;
esac
Image
User avatar
Flying Jack
Posts: 17
Joined: Mon Sep 25, 2006 4:36 am
Location: France
Contact:

Post by Flying Jack »

Hi,
Just one more question...
I've all my steamcast files in a /steamcast directory...

Code: Select all

server:/steamcast# ll
total 400K
drwxr-xr-x  2 root root 4,0K 2006-09-26 10:48 .
drwxr-xr-x 22 root root 4,0K 2006-09-25 23:12 ..
-rw-r--r--  1 root root 1003 2006-09-25 21:36 steamauth.txt
-rwxr-xr-x  1 root root 365K 2005-06-24 21:09 steamcast
-rw-r--r--  1 root root  13K 2006-09-26 10:41 steamcast.conf
But authentication doesn't work...
If I launch manually, with ./steamcast steamcast.conf it works fine...
How could I activate authfile with a daemon running steamcast ?
Where must I put steamauth.txt ? Or how could I launch steamcast with specify the steamauth.txt localization ?

Thanks a lot :)
Image
User avatar
Jay
Will work for food (Administrator)
Posts: 3020
Joined: Mon Jan 14, 2002 12:48 am
Location: Next Door
Contact:

Post by Jay »

you need to make sure the working directory is set to the steamcast exe's location. such as

cd /pathto/steamcast
- Jay
User avatar
Flying Jack
Posts: 17
Joined: Mon Sep 25, 2006 4:36 am
Location: France
Contact:

Post by Flying Jack »

Jay wrote:you need to make sure the working directory is set to the steamcast exe's location. such as

cd /pathto/steamcast
hey !
What an honor... the admin himself :)

The problem is that I run Steamcast as daemon, on boot...
(update-rc.d etc...)
How can I do ?
The other way I've try is to launch steamcast using screen...

Code: Select all

cd /pathto/steamcast ; screen -d -m ./steamcast steamcast.conf
But I would try to set up a full "daemonig mode"...

An idea ?
Image
User avatar
Jay
Will work for food (Administrator)
Posts: 3020
Joined: Mon Jan 14, 2002 12:48 am
Location: Next Door
Contact:

Post by Jay »

So how does running as a daemon stop you from changing the current working directory? Just do this in the startup script.
- Jay
User avatar
Flying Jack
Posts: 17
Joined: Mon Sep 25, 2006 4:36 am
Location: France
Contact:

Post by Flying Jack »

Jay wrote:So how does running as a daemon stop you from changing the current working directory? Just do this in the startup script.
Mmmhhh...
I don't really understand you answer...
You say that I have to put something like this:

Code: Select all

cd /my/path/of/steamcast

Code: Select all

echo "Starting $NAME";
here ?
        $SSD_BIN $SSD_GENERAL_OPTS --chuid ${SRV_UID}:${SRV_GID} --user $SRV_UID \
                --group $SRV_GID --start --background --exec $SRV_BIN $SRV_CFG > /dev/null 
Image
User avatar
Jay
Will work for food (Administrator)
Posts: 3020
Joined: Mon Jan 14, 2002 12:48 am
Location: Next Door
Contact:

Post by Jay »

well there are many ways you could do it but that should work.
- Jay
User avatar
Flying Jack
Posts: 17
Joined: Mon Sep 25, 2006 4:36 am
Location: France
Contact:

Post by Flying Jack »

Thanks,
I'll check tomorrow, and I'll post feedback.
Image
User avatar
Flying Jack
Posts: 17
Joined: Mon Sep 25, 2006 4:36 am
Location: France
Contact:

Post by Flying Jack »

Hi !
I've try lot of things, it doesn't work anymore...

Code: Select all

server:/home/user# more /etc/init.d/steamcast
#!/bin/bash

NAME="Steamcast"

SRV_BIN=/steamcast/steamcast
SRV_CFG=/steamcast/steamcast.conf
SRV_PATH=/steamcast

# On va faire tourner steamcast en tant que nobody:nogroup
# On peut bien sur creer un autre user (sans shell,...) si on veut, bien sur
SRV_UID=nobody
SRV_GID=nogroup

SSD_BIN=/sbin/start-stop-daemon
SSD_GENERAL_OPTS="--quiet"

case "$1" in
  start)
        echo "Starting $NAME";
        cd $SRV_PATH;
        $SSD_BIN $SSD_GENERAL_OPTS --chuid ${SRV_UID}:${SRV_GID} --user $SRV_UID \
                --group $SRV_GID --start --background --exec $SRV_BIN $SRV_CFG > /dev/null
        ;;
  stop)
        echo "Stopping $NAME";
        cd $SRV_PATH;
        $SSD_BIN $SSD_GENERAL_OPTS --chuid ${SRV_UID}:${SRV_GID} --user $SRV_UID \
                --group $SRV_GID --stop --exec $SRV_BIN $SRV_CFG > /dev/null
        ;;
  restart|force-reload)
        echo "Restart";
        ;;
  *)
        echo "Usage: {start|stop|restart|force-reload}" >&2
        exit 1
        ;;
esac
In user table, I still have

Code: Select all

Authenticated Users
User	Mount	Action
File not found
Thanks
Image
User avatar
Flying Jack
Posts: 17
Joined: Mon Sep 25, 2006 4:36 am
Location: France
Contact:

Post by Flying Jack »

I've try lot of different possibilities, the only one which works is:

Code: Select all

server:/home/user# more /etc/init.d/steamcast
#!/bin/bash

NAME="Steamcast"

SCREEN=/usr/local/bin/screen

# On va faire tourner steamcast en tant que nobody:nogroup
# On peut bien sur creer un autre user (sans shell,...) si on veut, bien sur
SRV_UID=nobody
SRV_GID=nogroup

SSD_BIN=/sbin/start-stop-daemon
SSD_GENERAL_OPTS="--quiet"

case "$1" in
  start)
        echo "Starting $NAME";
        $SSD_BIN $SSD_GENERAL_OPTS --chuid ${SRV_UID}:${SRV_GID} --user $SRV_UID \
                --group $SRV_GID --start --background --exec $SCREEN
        ;;
  stop)
        echo "Pour stopper SteamCast, killer les processus avec pkill steamcast puis kill -9 PID_STEAMCAST";
        ;;
  *)
        echo "Usage: {start|stop}" >&2
        exit 1
        ;;
esac
and

Code: Select all

server:/home/user# more /usr/local/bin/screen
#!/bin/bash
cd /steamcast ; /usr/bin/screen -d -m ./steamcast steamcast.conf > /dev/null
And SteamCast starts on boot, and authfile is recognize...
Image
Post Reply