Im trying to start a linux service, however im getting the below issue when im trying to start the service. Please help with a solution of how to fix this issue
The user Test_user is set with ALL=(ALL) ALL in sudoers file
Nov 17 11:20:24 systemd[1]: Starting wso2am-4.2.0.service...
Nov 17 11:20:24 wso2am-4.1.0[171210]: Starting the WSO2 Server ...
Nov 17 11:20:24 su[171211]: pam_unix(su:auth): auth could not identify
password for [Test_user] Nov 17 11:20:26 su[171211]: FAILED SU (to
Test_user) root on none Nov 17 11:20:27 wso2am-4.1.0[171210]:
Password: Password: su: Authentication failure Nov 17 11:20:27
systemd[1]: wso2am-4.2.0.service: Control process exited, code=exited
status=1 Nov 17 11:20:27 systemd[1]: wso2am-4.2.0.service: Failed
with result 'exit-code'.
The script contains:
#! /bin/sh
export JAVA_HOME="/usr/lib/jvm/java-11-openjdk-11.0.18.0.10-2.el8_7.x86_64"
startcmd='/var/wso2am-4.1.0/bin/api-manager.sh start > /dev/null &'
restartcmd='/var/wso2am-4.1.0/bin/api-manager.sh restart > /dev/null &'
stopcmd='/var/wso2am-4.1.0/bin/api-manager.sh stop > /dev/null &'
case "$1" in
start)
echo "Starting the WSO2 Server ..."
su -c "${startcmd}" Test_user
;;
restart)
echo "Re-starting the WSO2 Server ..."
su -c "${restartcmd}" Test_user
;;
stop)
echo "Stopping the WSO2 Server ..."
su -c "${stopcmd}" Test_user
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
esac
sudo
from within the service?