cHam
cHam

Reputation: 2664

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.

Upvotes: 0

Views: 1681

Answers (2)

Gyro Gearless
Gyro Gearless

Reputation: 5279

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

Upvotes: 1

Lee Meador
Lee Meador

Reputation: 12985

Maybe the path isn't set yet at startup time and you need the full path to the java executable or, possibly, nohup.

Upvotes: 1

Related Questions