<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>diginc &#187; gnump3d</title>
	<atom:link href="http://diginc.us/tag/gnump3d/feed/" rel="self" type="application/rss+xml" />
	<link>http://diginc.us</link>
	<description>\'dij-iŋk\</description>
	<lastBuildDate>Fri, 18 Jun 2010 20:17:25 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>GNUmp3d init.d with PIDs for running multiple instances of GNUmp3d</title>
		<link>http://diginc.us/2009/09/gnump3d-init-d-with-pids-for-running-multiple-instances-of-gnump3d/</link>
		<comments>http://diginc.us/2009/09/gnump3d-init-d-with-pids-for-running-multiple-instances-of-gnump3d/#comments</comments>
		<pubDate>Sat, 12 Sep 2009 05:07:15 +0000</pubDate>
		<dc:creator>diginc</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[gnump3d]]></category>
		<category><![CDATA[init.d]]></category>
		<category><![CDATA[invoke-rc.d]]></category>
		<category><![CDATA[service]]></category>

		<guid isPermaLink="false">http://diginc.us/?p=73</guid>
		<description><![CDATA[I made some modifications to my original gnump3d init.d script when I needed more than one instance of GNUmp3d running (for multiple folders completely separated). I still haven&#8217;t quite figured out how to get the tag database to work for &#8230; <a href="http://diginc.us/2009/09/gnump3d-init-d-with-pids-for-running-multiple-instances-of-gnump3d/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I made some modifications to my original gnump3d init.d script when I needed more than one instance of GNUmp3d running (for multiple folders completely separated).  I still haven&#8217;t quite figured out how to get the tag database to work for my second GNUmp3d instance, if anyone can help please leave a comment.  Here&#8217;s the script and some brief instructions:</p>
<p><span id="more-73"></span></p>
<p>/etc/init.d/gnump3d :</p>
<pre>
#!/bin/bash

gmconfig="/etc/gnump3d/gnump3d.conf"
gmport="54321"
gmpidfile="/var/run/gnump3d_$gmport.pid"

case "$1" in
start)
  if [ -f $gmpidfile ] ; then
    echo "GNUmp3d already running on port $gmport"
  else
    echo "Starting GNUmp3d."
    /usr/bin/gnump3d --background -config $gmconfig --port $gmport
    sleep 1
    ps -ef | grep -v "grep" | grep "config $gmconfig" | cut -c10-15 > $gmpidfile
  fi
;;
stop)
  if [ -f $gmpidfile ] ; then
    echo "Shutting down GNUmp3d."
    /bin/kill -9 $(cat $gmpidfile)
    rm $gmpidfile
  else
    echo "GNUmp3d isn't running on port $gmport yet"
  fi

;;
restart)
  $0 stop
  $0 start
;;
status)
  if [ -f $gmpidfile ] ; then
    echo "GNUmp3d running on port $gmport with config $gmconfig and pid $(cat $gmpidfile)"
    echo $(ps -ef | grep -v "grep" | grep "config $gmconfig")
    #echo
    # code to display the other instance of gnump3d here...
  else
    echo "GNUmp3d isn't running yet"
  fi
;;
*)
  echo "Usage: $0 {start|stop|restart|status}"
  exit 1
esac

exit 0
</pre>
<p>To run more than one copy of gnump3d with this simply make a copy of this script and call it something like gnump3d_2.</p>
<pre>sudo cp -vip /etc/init.d/gnump3d /etc/init.d/gnump3d_2</pre>
<p>Then change the new init.d script to point to your new config and port (pid file auto updates by port #).</p>
<pre>
gmconfig="/etc/gnump3d/gnump3d_2.conf"
gmport="54322"
</pre>
<p>Make a copy of the stock gnump3d config and modify the necessary lines.</p>
<pre>sudo cp -vip /etc/gnump3d/gnump3d.conf /etc/gnump3d/gnump3d_2.conf</pre>
<p>In my config I modified these lines:</p>
<pre>
port = 54322
root = /home/gnump3d_2
user = gnump3d_2
logfile = /var/log/gnump3d/access_2.log
errorlog = /var/log/gnump3d/error_2.log
now_playing_path = /var/cache/gnump3d_2/serving
tag_cache = /var/cache/gnump3d_2/song.tags
</pre>
<p>And lastly we&#8217;ll need to make the cache drectories:</p>
<pre>mkdir /var/cache/gnump3d_2/
mkdir /var/cache/gnump3d_2/serving
chmod -R 777 /var/cache/gnump3d_2
touch /var/cache/gnump3d_2/song.tags
</pre>
<p>And then you&#8217;re set to startup the second gnump3d instance.</p>
<pre>/etc/init.d/gnump3d_2 start</pre>
]]></content:encoded>
			<wfw:commentRss>http://diginc.us/2009/09/gnump3d-init-d-with-pids-for-running-multiple-instances-of-gnump3d/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
