Skip to content

Installation Guide: init.d

Mark Hughes edited this page Apr 25, 2021 · 2 revisions

Wiki Home / Installation Guides / init.d


This guide is for how you can setup droppy with init.d. In a lot of linux distributions, init.d is used for services. Once setup, you (or anyone with sudo on your server) can be manage droppy through the service command.

Configuration

By default the init.d script tries to use the safest defaults:

  • Config directory (DROPPY_CONFIG_DIR): /srv/droppy/config
  • Files directory (DROPPY_FILES_DIR): /srv/droppy/files
  • Runs as (RUNAS): droppy:droppy

You can modify these as you need, if you don't be aware that this script assumes that you have created the user droppy and those directories, and that the user droppy has access to those directories.

sudo groupadd droppy

If the group needs a specific group id (to match from say, a mounted drive) you can do so like this:

sudo groupadd -g 1234 droppy # replace 1234 with the GID you require

You also require the user droppy:

sudo useradd -r -g droppy -b /srv/droppy droppy 

You can specify a user id as well if you require:

sudo useradd -r -g droppy -b /srv/droppy -uid 1234 droppy  # replace 1234 with the UID you require

Lastly, we required the droppy directory to exist:

sudo mkdir -p /srv/droppy/config
sudo mkdir -p /srv/droppy/files
sudo chown -R droppy:droppy /srv/droppy

Installation

You can grab our init.d script from the droppy repo under examples: https://raw.githubusercontent.com/droppyjs/droppy/canary/examples/droppy.init.d

You can download and put this into your /etc/init.d directory using curl or wget:

# using curl:
sudo curl -o /etc/init.d/droppy.init.d https://raw.githubusercontent.com/droppyjs/droppy/canary/examples/droppy.init.d

# using wget:
sudo wget -O /etc/init.d/droppy.init.d https://raw.githubusercontent.com/droppyjs/droppy/canary/examples/droppy.init.d

You will then want to give it the correct permissions:

sudo chmod 755 /etc/init.d/droppy

Then you can execute update-rc.d to install the init script link.

sudo update-rc.d droppy defaults

Usage

You can use the following commands:

  • start droppy: sudo service droppy start
  • stop droppy: sudo service droppy stop
  • restart droppy: sudo service droppy restart