| View previous topic :: View next topic |
| Author |
Message |
bbk

Joined: 15 Oct 2005 Posts: 79
|
Posted: Sat Dec 23, 2006 12:45 pm Post subject: on-connect scripts |
|
|
hello
i use the following <on-connect> and <on-disconnect> scripts to start a transcoding on a freebsd server.
i write a pid file for the streamtranscoder and then i kill the process when it stops.
but it just works when i start from the shell (as well with the icecast user), when i let it start automaticly from icecast it creates the file but doesn't write into it.
| Code: |
<on-connect>/usr/local/share/icecast/bin/streamtranscoder1start.sh</on-connect>
<on-disconnect>/usr/local/share/icecast/bin/streamtranscoder1stop.sh</on-disconnect>
|
streamtranscoder1start.sh
| Code: |
#!/bin/sh
cd /usr/local/streamtranscoder/
/usr/local/bin/streamTranscoder -c /usr/local/streamtranscoder/streamtranscoder1.conf 1>/dev/null &
sleep 10
ps -aux |grep -v grep | grep /usr/local/streamtranscoder/streamtranscoder1.conf | awk '{print $2}' > /usr/local/streamtranscoder/pid/streamtranscoder1.pid
|
i tried to stop it directly without the pid file but it doesn't work neither
streamtranscoder1stop.sh
| Code: |
#!/bin/sh
kill -9 `ps -aux |grep -v grep | grep /usr/local/streamtranscoder/streamtranscoder1.conf | awk '{print $2}'`
kill -9 `cat /usr/local/streamtranscoder/pid/streamtranscoder1.pid`
rm /usr/local/streamtranscoder/pid/streamtranscoder1.pid
|
i think it is related to the way icecast starts the scritps, has anyone a idea what i do wrong or how to stop a process?
i could do some ugly things like writing into a file 0 or 1 read it out with a cronjob and then run the scripts.... but... i whould prefere to do this directly.
thx _________________ ::bbk::
http://audioasyl.net |
|
| Back to top |
|
 |
karlH Code Warrior

Joined: 13 Jun 2005 Posts: 5476 Location: UK
|
Posted: Sun Dec 24, 2006 3:10 am Post subject: |
|
|
The scripts are run when the stream has started or is shutting down so if the idea is that ST transcodes this stream to another mountpoint then the mechanism should be fine.
In the start script you don't need the ps/grep/awk etc to get the pid. You should be ok with just
echo $! > st.pid
Without knowing what it's actually doing then it's hard to say what the solution to the problem is. You may need from exho statements in the scripts to see how far it's getting.
karl. |
|
| Back to top |
|
 |
bbk

Joined: 15 Oct 2005 Posts: 79
|
Posted: Sun Dec 24, 2006 3:09 pm Post subject: thank you |
|
|
thank you very much... that did it!!
here is the working startscript:
streamtranscoder1start.sh
| Code: |
#!/bin/sh
cd /usr/local/streamtranscoder/
/usr/local/bin/streamTranscoder -c /usr/local/streamtranscoder/streamtranscoder1.conf 1>/dev/null &
sleep 10
echo $! > /usr/local/streamtranscoder/pid/streamtranscoder1.pid
|
yes i do a transcoding from a livestream to a other quality, both streams (lofi + hifi) have a (seperate) fallback.
the problem was when i disconnect the livestream it will start the fallback then it transcodes the fallback stream, which is unnessecary for me and each time i reconnect to the mountpoint with a source it starts a new transcode process.
somehow i don't know why it didn't work with ps/grep/awk... but with echo$! it works.
thank you _________________ ::bbk::
http://audioasyl.net |
|
| Back to top |
|
 |
bbk

Joined: 15 Oct 2005 Posts: 79
|
Posted: Tue Feb 13, 2007 12:40 pm Post subject: pid of streamtranscoder |
|
|
hello
unfortunatly it does not always (just sometimes) write the pid into the file.
i need to stop the transcoding after the stream stopped so is there a other way to get the pid file on my freebsd for the streamtranscoder?
or does anyone have a other idea?
thx _________________ ::bbk::
http://audioasyl.net |
|
| Back to top |
|
 |
karlH Code Warrior

Joined: 13 Jun 2005 Posts: 5476 Location: UK
|
Posted: Tue Feb 13, 2007 3:28 pm Post subject: |
|
|
You have to track this further, is it a question of ST dying before the file is written or a problem of actually writing the file?
karl. |
|
| Back to top |
|
 |
bbk

Joined: 15 Oct 2005 Posts: 79
|
Posted: Fri Sep 14, 2007 9:27 am Post subject: old freebsd version |
|
|
well... now with freebsd 6.2 it works well.
i think it was a problem with the freebsd 4.* we had.
greetz _________________ ::bbk::
http://audioasyl.net |
|
| Back to top |
|
 |
|