Hello Everyone today I’m going to show you how to create a simple upstart file in Ubuntu server for .jar file. So let’s look at the steps for achieve this.
- Login to the Ubuntu Machine and go to “/etc/init/” then create a file with your project name and the file extention should be .conf (In here let’s assume the project name is project-test)
$ cd /etc/init/ $ sudo vi project-test.conf
- Then add the following lines and Change the necessary configurations on that file. Because we should change the path for Project Directory, run-level, .PID file path, .log file path and so on.
start on (filesystem) stop on runlevel  respawn console log setuid nobody setgid nogroup chdir /srv/project-test/ script echo $$ > /var/run/project-test.pid java -jarproject-test.jar >> /var/log/project-test.sys.log end script
- After that save and exit and start the upstart file.
$ sudo start project-test
- Now you can see the upstart service is running, if it is not running please make sure to change the appropriate permission on “project-test.pid” and “project-test.sys.log” files and restart the upstart file.