there's a command to start up a service which is
su -s /bin/bash nuance -c '$JAVA_HOME/bin/java -Dlog4j.configurationFile=$NLPS_HOME/config/log4j2.xml -jar $NLPS_HOME/lib/nlps.jar --spring.config.location=$NLPS_HOME/config/,$NUANCE_DATA_DIR/system/config/User-nlps01.properties watcher.RestartOnFailure=FALSE watcher.SendAlarmsToWatcher=FALSE > /dev/null 2>&1 &'
I want this command to run at startup in my rhel 7 linux. So I tried crontab, which is @reboot sh /execute/nlp.sh
But it doesn't work, I don't know why. Please tell me what I'm doing wrong I'm so stuck Inside nlp.sh:
#!/bin/bash
/bin/su -s /bin/bash nuance -c '$JAVA_HOME/bin/java -Dlog4j.configurationFile=$NLPS_HOME/config/log4j2.xml -jar $NLPS_HOME/lib/nlps.jar --spring.config.location=$NLPS_HOME/config/,$NUANCE_DATA_DIR/system/config/User-nlps01.properties watcher.RestartOnFailure=FALSE watcher.SendAlarmsToWatcher=FALSE > /dev/null 2>&1 &'
You need to define
$JAVA_HOME
,$NLPS_HOME
and$NUANCE_DATA_DIR
environment variables are needed to be defined and exported before the execution of the script.