| View previous topic :: View next topic |
| Author |
Message |
Liquid_Squelch
Joined: 11 Mar 2006 Posts: 56
|
Posted: Sat Jun 19, 2010 1:43 am Post subject: Checking if a mount is connected via Bash |
|
|
Hi all,
I am trying to run a wget bash file that well - wget's a stream, archives the audio, and uploads it to my webserver (and inserts the correct code in mysql)
I am at the point now where everything is working, so I am adding some error checks into the script.
I would like the script to check to see if a mount is connected. If the mount is connected, continue with the script. If the mount is NOT connected, then error 1 and quit running.
It seems when I try and wget --spider, that I get an error on a valid and invalid mount point. When I spider my webhost, I get a "0" returned, so I know my syntax is correct.
What would be the proper way to ping the mount point to see if the feed is active?
Right now I am running the Windows Version of Icecast. Once I get my Linux box 100% (or close enough for me) I will move the Icecast service to Linux (openSUSE).
Any help on checking the 'health' of a mount would be a HUGE help, as this has been kicking my rear all week. Please keep in mind that I am very new to Bash coding.
THANK YOU for any help
Phil
EDIT: Found this thread: http://icecast.imux.net/viewtopic.php?t=6897
I guess I need to create a custom statusxml, or move the Icecast server to linux so I can use the "on-connect" feature to kick a counter file to 1 if connected, and 0 when it disconnects. |
|
| Back to top |
|
 |
karlH Code Warrior

Joined: 13 Jun 2005 Posts: 5476 Location: UK
|
Posted: Sat Jun 19, 2010 9:43 am Post subject: |
|
|
if you look at the status2.xsl as a baseline for easy parsing then that should cover all you need. An inactive on-demand relay will not have stats like started if that helps you, but I guess you only need a yes or no output from your description.
You then query the xsl like
http://host:port/my.xsl?mount=/stream
karl. |
|
| Back to top |
|
 |
Liquid_Squelch
Joined: 11 Mar 2006 Posts: 56
|
Posted: Sat Jun 19, 2010 11:53 am Post subject: |
|
|
Karl, Like always - thank you for the reply...
I created a custom xsl file, and call that via the BASH command.
When I open the xsl in a web browser, the output looks fine.
When I look at the path with "curl -s <url to file>" and check to output, it fails because it is reading the XSL header..
| Code: |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
Connected
|
Like I said - I am still very new to Linux, but I can already tell this is probably going to be easier going 1 of 2 ways...
Run my wget_status.xsl file to output the stream names one line at a time. Then use grep in the BASH command to search for the stream name in the output file. Am I on the right path???
From that, I would:
| Code: |
IF the line exists; then
echo Feed is connected
else
exit 1
fi
wget feed
More commands
|
I would like to move the Icecast server straight to linux, but there are a few more things I would like to play with before I roll it.
Thanks again for the help |
|
| Back to top |
|
 |
karlH Code Warrior

Joined: 13 Jun 2005 Posts: 5476 Location: UK
|
Posted: Sat Jun 19, 2010 2:24 pm Post subject: |
|
|
The doctype line is not a linux issue, it's an xsl issue, I suspect you have incorrect xsl: lines at the top.
Without knowing the scope of your implementation, you may find the xsl approach simple enough (but may generate a lot of lines in the access log) or maybe use the stats interface
curl 'http://admin:pw@host:port/'
Obviously if you are one to have several hundred streams on a single icecast then issuing wgets for each mount will be wasteful.
karl. |
|
| Back to top |
|
 |
|
|
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
|