Hi,
I have Splunk 7.0 installed on a 64-bit Linux host. I followed the instructions for enabling boot-start as a non-root user, but I am not able to figure out why it's still not working as expected. Here is what I have in my /etc/init.d/splunk file after the necessary su changes -
#!/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
. /etc/init.d/functions
splunk_start() {
echo Starting Splunk...
su - ${USER} -c '"/opt/splunk/bin/splunk start"' --no-prompt --answer-yes
RETVAL=$?
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/splunk
}
splunk_stop() {
echo Stopping Splunk...
su - ${USER} -c '"/opt/splunk/bin/splunk stop"'
RETVAL=$?
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/splunk
}
splunk_restart() {
echo Restarting Splunk...
su - ${USER} -c '"/opt/splunk/bin/splunk restart"'
RETVAL=$?
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/splunk
}
splunk_status() {
echo Splunk status:
su - ${USER} -c '"/opt/splunk/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
Any thoughts how I can fix this?
Thank you
MT
USER
isn't defined in your script, so there's no value to replace for ${USER}
.
Did you attempt to use splunk enable boot-start -user <splunk user>
to accomplish this, or some other means?