Results 1 to 2 of 2

Thread: run a new program as a service

  1. #1
    grglsn NNTP User

    Default run a new program as a service

    I have downloaded an HMI program that runs in Java. I would like to set
    it up to run as a service, but I don't know how.

    It was not an rpm, but a downloaded zip file, which I unzipped to
    /usr/local/bin/ignition as per the installation instructions. The
    install instructions are written for Ubuntu, so they say to get hal and
    then run the update-rc.d utility to get it to run as a service. Here are
    the instructions for ubuntu:

    Code:
    * Install Java 6 if it is not already installed
    apt-get install sun-java6-jre
    * Install the "hal" package.  This is required for licensing.
    apt-get install hal
    * Unzip files to /usr/local/bin/ignition
    unzip Ignition-build####-linux -d /usr/local/bin/ignition
    * Note: you will need to replace '####' with whatever the actual build
    number the file you are installing has.
    * Change into the directory you unzipped to
    cd /usr/local/bin/ignition
    
    * Set executable permissions on ignition.sh and ignition-gateway
    chmod +x ignition.sh
    chmod +x ignition-gateway
    * Create a symlink to ignition.sh in /etc/init.d/
    cd /etc/init.d/
    ln -s /usr/local/bin/ignition/ignition.sh ignition
    chmod +x ignition
    * Run the update-rc.d utility
    update-rc.d ignition defaults
    * You can now start and stop ignition with the following commands (as
    root/sudo)
    /etc/init.d/ignition start
    /etc/init.d/ignition stop
    * Ignition will start automatically when the computer boots up from here
    on out.  If you wish to stop this behaviour then you need to use the
    update-rc.d tool to remove the service and delete the symlink we created
    earlier
    /etc/init.d/ignition stop
    update-rc.d -f ignition remove
    rm /etc/init.d/ignition
    * The Gateway Control Utility can be launched via the gcu.sh shell
    script in /usr/local/bin/ignition.  It will need to be made executable
    first.
    chmod +x /usr/local/bin/ignition/gcu.sh
    * You are done.  Open a web browser and navigate to http://localhost:8088/.
    I tried to run the following, not being sure of what I was doing. As I
    thought, it didn't work.

    Code:
    tribaltrekker:/usr/local/bin/ignition # systemctl start ignition.service
    Failed to issue method call: Unit ignition.service failed to load: No
    such file or directory. See system logs and 'systemctl status
    ignition.service' for details.
    tribaltrekker:/usr/local/bin/ignition # systemctl status ignition.service
    ignition.service
    Loaded: error (Reason: No such file or directory)
    Active: inactive (dead)
    So how do I get this program to be noticed by systemd so that I can set
    it up to run as a service?

    I am able to run the executable by the following:
    Code:
    tribaltrekker:/usr/local/bin/ignition # ./ignition.sh start
    Starting Ignition Gateway...
    WARN   | wrapper  | An encoding declaration is missing from the top of
    configuration file:
    WARN   | wrapper  |   /usr/local/bin/ignition/wrapper-license.conf
    WARN   | wrapper  |   trying the system encoding.
    Waiting for Ignition Gateway...........
    running: PID:11729
    Notice that I was in the /usr/local/bin/ignition directory when I got it
    started. I didn't try and add that directory to my path.

    Thanks,

    --
    G.O.
    Box #1: 12.3 | KDE 4.10 | AMD Phenom IIX4 | 64 | 16GB
    Box #2: 12.2 | KDE 4.9.2 | AMD Athlon X3 | 64 | 4GB
    Laptop: 12.3 | KDE 4.10 | Core i7-2620M | 64 | 8GB


  2. #2
    Join Date
    Feb 2009
    Location
    Spain
    Posts
    25,547

    Default Re: run a new program as a service

    On 2013-07-18 09:18, grglsn wrote:
    > I have downloaded an HMI program that runs in Java. I would like to set
    > it up to run as a service, but I don't know how.
    >
    > It was not an rpm, but a downloaded zip file, which I unzipped to
    > /usr/local/bin/ignition as per the installation instructions. The
    > install instructions are written for Ubuntu, so they say to get hal and
    > then run the update-rc.d utility to get it to run as a service. Here are
    > the instructions for ubuntu:


    I don't know if you can get hal.


    > So how do I get this program to be noticed by systemd so that I can set
    > it up to run as a service?


    Because you have to create first the service file, ignition.service.
    Maybe it will work with "/etc/init.d/ignition start". Maybe you can
    configure it to autostart with "chkconfig ignition on".


    > Notice that I was in the /usr/local/bin/ignition directory when I got it
    > started. I didn't try and add that directory to my path.


    It worked because you added a "./" to the command name.

    --
    Cheers / Saludos,

    Carlos E. R.
    (from 12.3 x86_64 "Dartmouth" at Telcontar)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •