2

Hello I am running a kubuntu 13.10 distro, but I guess my question is pretty general...how to make a .jar execute in background at system start?

1 Answer 1

4

You can put your command in file /etc/rc.local:

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

java -jar file.jar &

exit 0
3
  • Instead of exiting 0, would it be better to exit with $?
    – spuder
    Apr 8, 2014 at 16:47
  • will it run as a background task this way? Or do I need to explicitely set a "&" after the command?
    – Phate
    Apr 8, 2014 at 19:18
  • Adding & to your command to make it running in background.
    – cuonglm
    Apr 8, 2014 at 19:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .