You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Lance Hendrix <ac...@lancehendrix.com> on 2009/01/15 19:10:32 UTC

Gentoo Init Scripts

I have not found information on the net for how to make ActiveMQ work as 
a daemon managed by the startup/init system for Gentoo, so I have had to 
create my own.  Hopefully posting this information to this DL will 
enable others to find this information.  I will also try to get this 
information posted elsewhere on the net, but feel free to 
use/post/re-use this information as you see fit.

------------------------------------------------------------------

In order to get ActiveMQ to run as a daemon and be managed by the init 
system on Gentoo, you will need to create two files.  The first is the 
/etc/init.d/activemq which is the startup script as you would expect.  
The second is the /etc/conf.d/activemq configuration file, which (in 
case you are not familiar with Gentoo's startup system) is sourced by 
the init system when starting a script.  Essentially, when Gentoo gets a 
request to start an init script, it checks in the /etc/conf.d directory 
for a file with the same name as the init script and if found, "sources" 
that file.  As a result, the "Gentoo way" is to place most, if not all 
configuration into these "conf" files in the conf.d directory.

This script is relatively simple and meets my needs, enabling starting, 
stopping, and restarting (automagically handled by the init system, 
which recognizes that if you have a "start" and a "stop" that it can 
chain them together to get a restart).  The system also seems to do a 
good job of managing the "pid" files and knowing when it has and has not 
been started.  The commands and java config were taken from the 
activemq-admin script that is supplied with activemq.  I have not tested 
the debug configuration and could probably be a little more cleaver than 
requiring one to uncomment/comment out the configuration, but perhaps 
someone will take this simple start and build upon it?

If you have any questions or comments on these, please feel free to 
respond back to the DL; however, please also copy me directly if you 
would like me to respond.  Enjoy!

I left the Gentoo copyright statements (GNU flavor) as this was 
essentially re-used from their framework.  I also borrowed heavily from 
the Gentoo startup scripts provided with the Tomcat project which 
demonstrated how to get the init system start and properly recognize 
java.  As a result I take little credit for this work instead owing to 
the maintainers of the Gentoo Tomcat package for their ingenuity and 
hard work.

The files:

/etc/init.d/activemq
-------------------------------------------------------------------------
#!/sbin/runscript
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

depend() {
        use net
}

start() {
        ebegin "Starting ActiveMQ $1"
        start-stop-daemon --start --background --make-pidfile --pidfile 
${PIDFILE} --exec ${JAVA_HOME}/bin/java -- ${JAVA_OPTS} start >> 
${OUTFILE}  2>&1
        eend $?
}

stop()  {
        ebegin "Stopping ActiveMQ $1"
        start-stop-daemon --stop --pidfile ${PIDFILE} --exec 
${JAVA_HOME}/bin/java -- ${JAVA_OPTS} stop
        eend $?
}
-------------------------------------------------------------------------

/etc/conf.d/activemq
-------------------------------------------------------------------------
JAVA_HOME=`java-config --jre-home`
ACTIVEMQ_HOME="/usr/share/activemq"
ACTIVEMQ_BASE="/usr/share/activemq"
ACTIVEMQ_CLASSPATH="${ACTIVEMQ_BASE}/conf;"$ACTIVEMQ_CLASSPATH
ACTIVEMQ_OPTS="-Xmx512M -Dorg.apache.activemq.UseDedicatedTaskRunner=true"
PIDFILE="/var/run/activemq.pid"
OUTFILE="/var/log/activemq.out"
# Uncomment to enable remote debugging
#ACTIVEMQ_DEBUG_OPTS="-Xdebug -Xnoagent -Djava.compiler=NONE 
-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005"

JAVA_OPTS="$ACTIVEMQ_DEBUG_OPTS $ACTIVEMQ_OPTS 
-Dactivemq.classpath=${ACTIVEMQ_CLASSPATH} 
-Dactivemq.home=${ACTIVEMQ_HOME} -Dactivemq.base=${ACTIVEMQ_BASE} -jar 
${ACTIVEMQ_HOME}/bin/run.jar"
--------------------------------------------------------------------------

Re: Debian / ubuntu package ActiveMQ

Posted by Dejan Bosanac <de...@nighttale.net>.
Hi,

Unfortunately, nothing significant is done in this area so far, so any
contribution is appreciated. I played a bit with unix-maven-plugin

http://fisheye6.atlassian.com/browse/activemq/trunk/assembly/pom-deb.xml?r=HEAD

but didn't like it after all. So if you can create a script that will make a
.deb package from current tag.gz archive, that would be great.

Cheers
--
Dejan Bosanac - http://twitter.com/dejanb

Open Source Integration - http://fusesource.com/
ActiveMQ in Action - http://www.manning.com/snyder/
Blog - http://www.nighttale.net


On Fri, May 14, 2010 at 4:37 PM, xcalavero <mg...@dvidea.com> wrote:

>
> Hi,
>
> I'm looking for .deb of activeMQ and find your post.
>
> Did you work together on this to make ubuntu or Debian package ?
>
> If not, I available to work with you on this.
>
> Take me inform,
>
> Ghislain MOKOLOMBOKA
>
>
>
> Dejan Bosanac wrote:
> >
> > Yeah. I would love to work on this.
> >
> > Cheers
> > --
> > Dejan Bosanac
> >
> > Open Source Integration - http://fusesource.com/
> > ActiveMQ in Action - http://www.manning.com/snyder/
> > Blog - http://www.nighttale.net
> >
> >
> > On Thu, Jan 15, 2009 at 8:16 PM, Bruce Snyder wrote:
> >
> >> On Thu, Jan 15, 2009 at 11:26 AM, Dejan Bosanac
> >> wrote:
> >> > It would be great if you could post this info somewhere in the
> ActiveMQ
> >> > wiki. Maybe on this page http://activemq.apache.org/unix-service.html
> >> >
> >> > I wonder if we should prepare ActiveMQ distributions for easier
> >> installation
> >> > and use with various Linux distros e.g Gentoo (portage), Ubuntu/Debian
> >> > (APT), RH (Yum) and so on?
> >> >
> >> > I'd be beautiful if users could do
> >> >
> >> > sudo apt-get install activemq
> >> >
> >> > or
> >> >
> >> > emerge activemq
> >> >
> >> > and have it ready for use
> >>
> >> This is a great idea, Dejan. One that I began investigating a couple
> >> years ago. The best way to do this is to create .deb, .rpm, etc. files
> >> for ActiveMQ and get those into various  distributions. Creating those
> >> file types can be done using Maven, but we need to follow the
> >> procedures for packaging and inclusion for each Linux distribution.
> >>
> >> Care to work together on this, Dejan? Let's take this discussion to
> >> the dev list.
> >>
> >> Bruce
> >> --
> >> perl -e 'print
> >> unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E );'
> >>
> >> Apache ActiveMQ - http://activemq.org/
> >> Apache Camel - http://activemq.org/camel/
> >> Apache ServiceMix - http://servicemix.org/
> >>
> >> Blog: http://bruceblog.org/
> >>
> >
> >
> > -----
> > Dejan Bosanac
> >
> > Open Source Integration - http://fusesource.com/
> > ActiveMQ in Action - http://www.manning.com/snyder/
> > Blog - http://www.nighttale.net
> >
>
> --
> View this message in context:
> http://old.nabble.com/Gentoo-Init-Scripts-tp21483559p28560237.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>

Debian / ubuntu package ActiveMQ

Posted by xcalavero <mg...@dvidea.com>.
Hi,

I'm looking for .deb of activeMQ and find your post.

Did you work together on this to make ubuntu or Debian package ?

If not, I available to work with you on this.

Take me inform,

Ghislain MOKOLOMBOKA



Dejan Bosanac wrote:
> 
> Yeah. I would love to work on this.
> 
> Cheers
> --
> Dejan Bosanac
> 
> Open Source Integration - http://fusesource.com/
> ActiveMQ in Action - http://www.manning.com/snyder/
> Blog - http://www.nighttale.net
> 
> 
> On Thu, Jan 15, 2009 at 8:16 PM, Bruce Snyder wrote:
> 
>> On Thu, Jan 15, 2009 at 11:26 AM, Dejan Bosanac 
>> wrote:
>> > It would be great if you could post this info somewhere in the ActiveMQ
>> > wiki. Maybe on this page http://activemq.apache.org/unix-service.html
>> >
>> > I wonder if we should prepare ActiveMQ distributions for easier
>> installation
>> > and use with various Linux distros e.g Gentoo (portage), Ubuntu/Debian
>> > (APT), RH (Yum) and so on?
>> >
>> > I'd be beautiful if users could do
>> >
>> > sudo apt-get install activemq
>> >
>> > or
>> >
>> > emerge activemq
>> >
>> > and have it ready for use
>>
>> This is a great idea, Dejan. One that I began investigating a couple
>> years ago. The best way to do this is to create .deb, .rpm, etc. files
>> for ActiveMQ and get those into various  distributions. Creating those
>> file types can be done using Maven, but we need to follow the
>> procedures for packaging and inclusion for each Linux distribution.
>>
>> Care to work together on this, Dejan? Let's take this discussion to
>> the dev list.
>>
>> Bruce
>> --
>> perl -e 'print
>> unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E );'
>>
>> Apache ActiveMQ - http://activemq.org/
>> Apache Camel - http://activemq.org/camel/
>> Apache ServiceMix - http://servicemix.org/
>>
>> Blog: http://bruceblog.org/
>>
> 
> 
> -----
> Dejan Bosanac
> 
> Open Source Integration - http://fusesource.com/
> ActiveMQ in Action - http://www.manning.com/snyder/
> Blog - http://www.nighttale.net
> 

-- 
View this message in context: http://old.nabble.com/Gentoo-Init-Scripts-tp21483559p28560237.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Gentoo Init Scripts

Posted by Dejan Bosanac <de...@nighttale.net>.
Yeah. I would love to work on this.

Cheers
--
Dejan Bosanac

Open Source Integration - http://fusesource.com/
ActiveMQ in Action - http://www.manning.com/snyder/
Blog - http://www.nighttale.net


On Thu, Jan 15, 2009 at 8:16 PM, Bruce Snyder <br...@gmail.com>wrote:

> On Thu, Jan 15, 2009 at 11:26 AM, Dejan Bosanac <de...@nighttale.net>
> wrote:
> > It would be great if you could post this info somewhere in the ActiveMQ
> > wiki. Maybe on this page http://activemq.apache.org/unix-service.html
> >
> > I wonder if we should prepare ActiveMQ distributions for easier
> installation
> > and use with various Linux distros e.g Gentoo (portage), Ubuntu/Debian
> > (APT), RH (Yum) and so on?
> >
> > I'd be beautiful if users could do
> >
> > sudo apt-get install activemq
> >
> > or
> >
> > emerge activemq
> >
> > and have it ready for use
>
> This is a great idea, Dejan. One that I began investigating a couple
> years ago. The best way to do this is to create .deb, .rpm, etc. files
> for ActiveMQ and get those into various  distributions. Creating those
> file types can be done using Maven, but we need to follow the
> procedures for packaging and inclusion for each Linux distribution.
>
> Care to work together on this, Dejan? Let's take this discussion to
> the dev list.
>
> Bruce
> --
> perl -e 'print
> unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
> );'
>
> Apache ActiveMQ - http://activemq.org/
> Apache Camel - http://activemq.org/camel/
> Apache ServiceMix - http://servicemix.org/
>
> Blog: http://bruceblog.org/
>

Re: Gentoo Init Scripts

Posted by Bruce Snyder <br...@gmail.com>.
On Thu, Jan 15, 2009 at 11:26 AM, Dejan Bosanac <de...@nighttale.net> wrote:
> It would be great if you could post this info somewhere in the ActiveMQ
> wiki. Maybe on this page http://activemq.apache.org/unix-service.html
>
> I wonder if we should prepare ActiveMQ distributions for easier installation
> and use with various Linux distros e.g Gentoo (portage), Ubuntu/Debian
> (APT), RH (Yum) and so on?
>
> I'd be beautiful if users could do
>
> sudo apt-get install activemq
>
> or
>
> emerge activemq
>
> and have it ready for use

This is a great idea, Dejan. One that I began investigating a couple
years ago. The best way to do this is to create .deb, .rpm, etc. files
for ActiveMQ and get those into various  distributions. Creating those
file types can be done using Maven, but we need to follow the
procedures for packaging and inclusion for each Linux distribution.

Care to work together on this, Dejan? Let's take this discussion to
the dev list.

Bruce
-- 
perl -e 'print unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
);'

Apache ActiveMQ - http://activemq.org/
Apache Camel - http://activemq.org/camel/
Apache ServiceMix - http://servicemix.org/

Blog: http://bruceblog.org/

Re: Gentoo Init Scripts

Posted by Dejan Bosanac <de...@nighttale.net>.
It would be great if you could post this info somewhere in the ActiveMQ
wiki. Maybe on this page http://activemq.apache.org/unix-service.html

I wonder if we should prepare ActiveMQ distributions for easier installation
and use with various Linux distros e.g Gentoo (portage), Ubuntu/Debian
(APT), RH (Yum) and so on?

I'd be beautiful if users could do

sudo apt-get install activemq

or

emerge activemq

and have it ready for use

Cheers
--
Dejan Bosanac

Open Source Integration - http://fusesource.com/
ActiveMQ in Action - http://www.manning.com/snyder/
Blog - http://www.nighttale.net


On Thu, Jan 15, 2009 at 7:10 PM, Lance Hendrix <ac...@lancehendrix.com>wrote:

> I have not found information on the net for how to make ActiveMQ work as a
> daemon managed by the startup/init system for Gentoo, so I have had to
> create my own.  Hopefully posting this information to this DL will enable
> others to find this information.  I will also try to get this information
> posted elsewhere on the net, but feel free to use/post/re-use this
> information as you see fit.
>
> ------------------------------------------------------------------
>
> In order to get ActiveMQ to run as a daemon and be managed by the init
> system on Gentoo, you will need to create two files.  The first is the
> /etc/init.d/activemq which is the startup script as you would expect.  The
> second is the /etc/conf.d/activemq configuration file, which (in case you
> are not familiar with Gentoo's startup system) is sourced by the init system
> when starting a script.  Essentially, when Gentoo gets a request to start an
> init script, it checks in the /etc/conf.d directory for a file with the same
> name as the init script and if found, "sources" that file.  As a result, the
> "Gentoo way" is to place most, if not all configuration into these "conf"
> files in the conf.d directory.
>
> This script is relatively simple and meets my needs, enabling starting,
> stopping, and restarting (automagically handled by the init system, which
> recognizes that if you have a "start" and a "stop" that it can chain them
> together to get a restart).  The system also seems to do a good job of
> managing the "pid" files and knowing when it has and has not been started.
>  The commands and java config were taken from the activemq-admin script that
> is supplied with activemq.  I have not tested the debug configuration and
> could probably be a little more cleaver than requiring one to
> uncomment/comment out the configuration, but perhaps someone will take this
> simple start and build upon it?
>
> If you have any questions or comments on these, please feel free to respond
> back to the DL; however, please also copy me directly if you would like me
> to respond.  Enjoy!
>
> I left the Gentoo copyright statements (GNU flavor) as this was essentially
> re-used from their framework.  I also borrowed heavily from the Gentoo
> startup scripts provided with the Tomcat project which demonstrated how to
> get the init system start and properly recognize java.  As a result I take
> little credit for this work instead owing to the maintainers of the Gentoo
> Tomcat package for their ingenuity and hard work.
>
> The files:
>
> /etc/init.d/activemq
> -------------------------------------------------------------------------
> #!/sbin/runscript
> # Copyright 1999-2004 Gentoo Foundation
> # Distributed under the terms of the GNU General Public License v2
>
> depend() {
>       use net
> }
>
> start() {
>       ebegin "Starting ActiveMQ $1"
>       start-stop-daemon --start --background --make-pidfile --pidfile
> ${PIDFILE} --exec ${JAVA_HOME}/bin/java -- ${JAVA_OPTS} start >> ${OUTFILE}
>  2>&1
>       eend $?
> }
>
> stop()  {
>       ebegin "Stopping ActiveMQ $1"
>       start-stop-daemon --stop --pidfile ${PIDFILE} --exec
> ${JAVA_HOME}/bin/java -- ${JAVA_OPTS} stop
>       eend $?
> }
> -------------------------------------------------------------------------
>
> /etc/conf.d/activemq
> -------------------------------------------------------------------------
> JAVA_HOME=`java-config --jre-home`
> ACTIVEMQ_HOME="/usr/share/activemq"
> ACTIVEMQ_BASE="/usr/share/activemq"
> ACTIVEMQ_CLASSPATH="${ACTIVEMQ_BASE}/conf;"$ACTIVEMQ_CLASSPATH
> ACTIVEMQ_OPTS="-Xmx512M -Dorg.apache.activemq.UseDedicatedTaskRunner=true"
> PIDFILE="/var/run/activemq.pid"
> OUTFILE="/var/log/activemq.out"
> # Uncomment to enable remote debugging
> #ACTIVEMQ_DEBUG_OPTS="-Xdebug -Xnoagent -Djava.compiler=NONE
> -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005"
>
> JAVA_OPTS="$ACTIVEMQ_DEBUG_OPTS $ACTIVEMQ_OPTS
> -Dactivemq.classpath=${ACTIVEMQ_CLASSPATH} -Dactivemq.home=${ACTIVEMQ_HOME}
> -Dactivemq.base=${ACTIVEMQ_BASE} -jar ${ACTIVEMQ_HOME}/bin/run.jar"
> --------------------------------------------------------------------------
>