Configure A Upstart File In Ubuntu Server.

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.

  1. 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

  2. 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 [016]
    console log
    setuid nobody
    setgid nogroup
    chdir /srv/project-test/
    echo $$ > /var/run/
    java -jarproject-test.jar >> /var/log/project-test.sys.log 
    end script
  3. After that save and exit and start the upstart file.
    $ sudo start project-test
  4. Now you can see the upstart service is running, if it is not running please make sure to change the appropriate permission on “” and “project-test.sys.log” files and restart the upstart file.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s