有一个启动服务的命令,
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 &'
我希望这个命令在我的 rhel 7 linux 启动时运行。于是我尝试了crontab,也就是@reboot sh /execute/nlp.sh
但它不起作用,我不知道为什么。请告诉我我做错了什么我被困在 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 &'