Archive

Posts Tagged ‘init’

upstart

August 1, 2017 Leave a comment

Problem:
Well this was more like an irritant. I have a portforwarding script that I manually start. I just got tired of doing that and moved it to an upstart task.

Solution:
Added the following job for upstart to handle.

$ less /etc/init/portforward.conf
description     "Portforward 3141 to devpi server"

author      "Vagrant"

start on runlevel [2345]
stop on runlevel [!2345]

script
    cd /home/vagrant

    export SSHPASS="vagrant"
    sshpass -e ssh -nNL 3141:192.168.38.18:3141 -o ConnectTimeout=10 -o LogLevel=Error -o StrictHostKeyChecking=no vagrant@192.168.38.18
end script
$
$ # Check the syntax
$ init-checkconf /etc/init/portforward.conf
$ # Start the job
$ sudo service portforward start

Source:
https://www.digitalocean.com/community/tutorials/the-upstart-event-system-what-it-is-and-how-to-use-it

Advertisements
Categories: bash Tags: ,