Run as service

Axion can be set up to run as service.

For example, in Linux:

  1. Create a systemd unit file.

    sudo nano /etc/systemd/system/axion.service

    The unit file should contain, for example:

    [Unit]
    Description=axion
    Wants=postgresql.service
    After=network.target local-fs.target postgresql.service
    
    [Service]
    Type=simple
    User=axion
    WorkingDirectory=/home/axion/
    SyslogIdentifier=axion
    TimeoutSec=5min
    Restart=on-failure
    RestartSec=5s
    SuccessExitStatus=143
    ExecStart=java -jar /home/axion/axion-0.1.0.jar --application.keys.google_analytics=G-123456
    ExecStop=/bin/kill -15 $MAINPID
    
    [Install]
    WantedBy=multi-user.target
    1. If you need to use Axion in developer mode with H2 DB, remove lines with postgresql.service in the Unit section of the unit file.

    2. Make sure that Axion version and location directory is mentioned correctly in the unit file.

  2. Your system service has been added to your service. Reload the systemctl daemon to read the new file. Reload command:

    sudo systemctl daemon-reload
  3. Run Axion as a service with command:

    sudo systemctl start axion.service