C-Gate comms on Ubuntu Linux

Discussion in 'C-Bus Toolkit and C-Gate Software' started by more-solutions, Jul 6, 2011.

  1. more-solutions

    more-solutions

    Joined:
    Apr 23, 2006
    Messages:
    271
    Likes Received:
    4
    Location:
    Peterborough, UK
    Having just played with this I thought some people might find this useful.

    Later versions of Ubuntu have upstart to manage system processes, and I've just got this working with cgate.

    Basics: I have a cgate user/group, and my cgate files are installed in /opt/cgate (owned by the cgate user).

    I created /etc/init/cgate.conf as follows:
    Code:
    # C-Gate Service
    
    description     "C-Gate"
    author          "Mark Rogers <[email protected]>"
    
    start on (net-device-up
              and local-filesystems
              and runlevel [2345])
    stop on runlevel [016]
    
    respawn
    script
            cd /opt/cgate
            sudo -ucgate -gcgate java -noverify -jar cgate.jar
    end script
    
    .. then start it with
    Code:
    sudo start cgate
    If cgate dies (or I kill it) it automatically restarts as it should. (To stop it properly, use "sudo stop cgate".)

    I particularly like the fact that I will have another service that depends on cgate, so it's .conf file will include:
    Code:
    start on started cgate
    stop on stopped cgate
    so that it starts automatically when cgate does, and stops automatically if cgate does.

    Note that it's early days and I haven't tested this much yet, I thought I'd share it while it was fresh in my mind!
    </[email protected]>
     
    more-solutions, Jul 6, 2011
    #1
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.