Icecast Streaming Media Server Forum Index Icecast Streaming Media Server
Icecast is a Xiph Foundation Project
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

FAQ: Using <on-connect>, an easy way

 
Post new topic   Reply to topic    Icecast Streaming Media Server Forum Index -> Icecast Server
View previous topic :: View next topic  
Author Message
epe
Asesor espaņol
Asesor espaņol


Joined: 27 Aug 2005
Posts: 132
Location: Quito - Ecuador

PostPosted: Sun Jan 24, 2010 1:36 pm    Post subject: FAQ: Using <on-connect>, an easy way Reply with quote

hi
today I woke up early, and having nothing to do, decided to put <on-connect> working inside my chrooted icecast. The server is CentOS-5

For a person with knowledge of linux shell, it will be quite easy. I expect you to have a moderate knowledge of Linux sysadmin in order to know exactly what we will be dong

Actually I saw little documentation on this TAG, therefore it took me a little, but here is how:

install busybox, as busybox has a very simple but functional shell similar to bash called: ash, also because busybox is statically compiled and then we avoid copying 10's of libraries, and because busybox has several shell commands included in it, then we also avoid copying these commands and libraries inside the chroot

Code:
yum install busybox


My icecast is installed under:
/usr/share/icecast

So I will create a bin directory inside that dir:
Code:
cd /usr/share/icecast
mkdir sbin
ln -s sbin bin
cp /sbin/busybox /usr/share/icecast/sbin/
cd sbin
ln -s busybox touch
ln -s busybox ash
ln -s busybox wget
ln -s busybox ls
ln -s busybox echo


as you can see, we are softlinking some known commands to busybox, busybox works like this, if we invoke from within the jail one of these commands, then busybox will know from $0 the purpose and act accordingly.

you can see a list of compiled commands inside busybox by simply calling it:
Code:
busybox

Of course you are free to ln -s any other commands you might need

ok, our jail is ready, let's test it:
Code:
chroot /usr/share/icecast /bin/ash


we are chrooting inside /usr/share/icecast and then invoking /bin/ash.

you should get a funny shell, something like:
Code:
/ $


You are inside the jail, try using ls for example:
Code:
/bin/ls

you should invoke the command with the full path in order for it to work.

Now exit the jail by pressing CONTROL D

If you wish, now you can create a script inside /usr/share/icecast for example let's call it: on-connect:
Code:
vi /usr/share/icecast/on-connect


put the following code inside:
Code:
#!/bin/ash
/bin/echo $1 >> /log/example


Then chmod it to +x:
Code:
chmod +x /usr/share/icecast/on-connect


you can then modify a mount-point adding the following line;
<on-connect>/on-connect</on-connect>

reload icecast
and every time this mount-point connect, the script will be invoked and it will write to /usr/share/icecat/log/example the name of the radio (it is the only parameter that is passed to the script, $1 = /radioname )

In case of trouble:
try chrooting into the icecast dir, and invoke the command(s) from within the shell and of course with the full path. Usually you will forget invoking with the full path

It should work, I hope it gets easier for you to use on-connect
_________________
--
http://www.NuestroServer.com
USA: +1 305 359 4495, Espaņa: +34 911 877 602
Ecuador: +593 2 600 4454
Se habla espaņol
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Icecast Streaming Media Server Forum Index -> Icecast Server All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2002 phpBB Group
subRebel style by ktauber