Hello ,
I configured splunk to start at boot time , i checked the permissions and the script all looks good to me , But when i am rebooting the server , Splunk is not starting up automatically.
here is my init.d script
#!/bin/sh
#
# /etc/init.d/splunk
# init script for Splunk.
# generated by 'splunk enable boot-start'.
#
# chkconfig: 2345 90 60
# description: Splunk indexer service
#
RETVAL=0
USER=splunk
. /etc/init.d/functions
splunk_start() {
echo Starting Splunk...
su - ${USER} -c '"$SPLUNK_HOME/bin/splunk" start --no-prompt --answer-yes'
RETVAL=$?
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/splunk
}
splunk_stop() {
echo Stopping Splunk...
su - ${USER} -c '"$SPLUNK_HOME/bin/splunk" stop'
RETVAL=$?
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/splunk
}
splunk_restart() {
echo Restarting Splunk...
su - ${USER} -c '"$SPLUNK_HOME/bin/splunk" restart'
RETVAL=$?
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/splunk
}
splunk_status() {
echo Splunk status:
su - ${USER} -c '"$SPLUNK_HOME/bin/splunk" status'
RETVAL=$?
}
case "$1" in
start)
splunk_start
;;
stop)
splunk_stop
;;
restart)
splunk_restart
;;
status)
splunk_status
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 1
;;
esac
exit $RETVAL
Once the VM is up after reboot , When i check manually the status of splunk it says its not running and getting below messages
splunkd 6519 was not running.
Stopping splunk helpers...
[ OK ]
Done.
Stopped helpers.
Removing stale pid file... done.
splunkd is not running.
I identified the issue , Their was a mistake in init script , After correcting it , The boot start worked.
Hi kumar493,
A few questions to see where you are at and what you have done:
Look forward to hearing back from you!
V/R,
nwuest
What will happen when you are running this script as root? : I never tried to run it as root , All i tried is rebooting the server and hoping splunk will start automatically but its not starting.
Have you tried use systemd version of boot start?
- No i haven't tried of using that.
I identified the issue , Their was a mistake in init script , After correcting it , The boot start worked.
Hi @kumar493
I am facing the similar issue with splunk boot start implementation. Could you please let me know what changes you made in init script.
Thanks in advance
Please post the resolution. It can help some one.