Skip to content
This repository has been archived by the owner on Mar 7, 2023. It is now read-only.

Upstart

Nathaniel Baughman edited this page Mar 18, 2016 · 1 revision

Upstart Integration

This article documents a way to run blockchain-wallet-service at system boot, loosely based on this article.

Objective

Start blockchain-wallet-service at system boot (& cleanly stop upon shutdown).

Notes & Caveats

  • This is specific to upstart in Ubuntu 14.04 (but may work elsewhere).
  • There are other system startup techniques. This one seems simple.
  • This is not yet well tested. Use at your own risk.
  • In this example, nodejs/npm/blockchain-wallet-service are installed via NVM (similar to this article) under a non-privileged user account (named user in the example below), and the file below configures the service to run as this user (rather than root).

Configuration

Create /etc/init/blockchain-wallet-service.conf:

description "blockchain-wallet-service"

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

setuid user

script
    export PATH="/home/user/.nvm/versions/node/v0.12.10/bin"
    exec blockchain-wallet-service start --port 3000
end script

Operation

  • The service should start during the boot process and stop on shutdown.
  • Log output from the service will go into /var/log/upstart/blockchain-wallet-service.log.
  • To manually start the service: sudo service blockchain-wallet-service start
  • You can also stop, restart, and check status.

Respawn

Upstart has a respawn directive for restarting a service if it crashes, which would be good to learn about and document here...

Clone this wiki locally