Deployment Architecture

How to set Splunk Mobile Access Server to automatically start at system boot on Linux?

Explorer

What's the best way to set the Splunk Mobile Access Server to automatically start at boot time under Linux?

Manually, it's necessary to go into the "/opt/mserver" directory then "./server.sh start" does the trick.

I'm imagining that I can put an entry into "/etc/init.d" and/or link the script to "/etc/rc3.d" to do a similar thing, but is there a better/recommended way?

Thanks!

1 Solution

Motivator

Since the documentation omits any mention of a command-line tool (similar to splunk boot-enable) I would be inclined to use whatever normal tool you would use to install a new service on your chosen distro.

If that is RPM based it would involve a script in init.d and the use of chkconfig. Other distros have other mechanisms (I'm guessing yours is Slackware), but yes your basic intent is correct.

View solution in original post

Motivator

Since the documentation omits any mention of a command-line tool (similar to splunk boot-enable) I would be inclined to use whatever normal tool you would use to install a new service on your chosen distro.

If that is RPM based it would involve a script in init.d and the use of chkconfig. Other distros have other mechanisms (I'm guessing yours is Slackware), but yes your basic intent is correct.

View solution in original post

Explorer

Thanks for your input. That's what I'd figured too.

So here's my solution, which I'm posting so others in the future might find it useful.

It turns out that the script that comes with the Mobile Access Server isn't suitable for use via "chkconfig" and requires some modification.

STEP 1: Modify the startup script

The original "server.sh" startup script is designed to be run from mserver home directory, so it needs a little modification. So go to /opt/mserver or wherever you've got it and open up "server.sh".

Comment out (or delete if you're so inclined) these two lines:

 # PRG="$0"
 # PRGDIR=`dirname "$PRG"`

and change this line

 # cd $PRGDIR/server
 cd /opt/mserver/server

Save the result into /etc/init.d/mserver then chmod 755 it. It will also need to be owned by root so chown it if necessary.

STEP 2: Link into rc3.d

The script isn't compatible with chkconfig so the easy way around this is to link it yourself into rc3.d

 sudo cd /etc/rc3.d
 sudo ln -s ../init.d/mserver S91mserver

By giving it the name S91mserver it will load AFTER splunkd and splunkweb, which are started by S90splunk.

Test your work by trying:

 sudo ./S91mserver start

That's it! FYI I have been using Centos 6.5 with Splunk 6.1.3 and Mobile Access Server version 1.0.1