简体   繁体   中英

using rc.local to start a jar file at startup is not working

I have a .jar file I want to run whenever the system reboots/starts, so I put the line

nohup java -jar /mnt/fioa/fusion/nfs/labStats/LabInfoAutoLog.jar > /dev/null &

in my /etc/rc.local file. The program is validated as working, and if I run the above command at the command line the program works as expected.

Other versions I have tried without success:

nohup /usr/bin/java -jar /mnt/fioa/fusion/nfs/labStats/LabInfoAutoLog.jar > /dev/null &

and:

nohup java -jar /mnt/fioa/fusion/nfs/labStats/LabInfoAutoLog.jar 2> /dev/null \ .. &

I am running centos 6.4.

也许路径在启动时尚未设置,您需要java可执行文件的完整路径,或者可能是nohup

Check that your jar file is accesible roots, NFS mounted volumes may impose special restrictions for root.

Instead of discarding your error messages, you might want to route them to syslog, something like 2> /sbin/logger -t FOO 1> /sbin/logger -t BAR

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM