Starting pico engine on system reboot
The pico engine runs on a host system.
When using ssh
to start it, one needs to take steps so that it won’t be stopped when that session ends. Some possibilities:
nohup
a Linux system commandforever
a npm module
When the host system reboots for whatever reason, steps have to be taken to ensure that the pico engine is started once the system has booted up sufficiently.
This can be done with systemd
which is built-in to Linux. Here is a sample configuration file (named /etc/systemd/system/pico-engine.service
):
[Unit]
Description=pico-engine
After=remote-fs.target
[Service]
User=USERNAME
Environment="PICO_ENGINE_BASE_URL=http://HOSTNAME:PORT"
ExecStart=/usr/local/bin/pico-engine
Restart=always
Where:
USERNAME is the Linux user who/which will be running the pico engine
HOSTNAME is the externally visible hostname of this server machine
PORT is the port on which the pico engine listens
Notes:
The
After
item identifies the point in time, during the boot process, at which the pico engine is to be started. In this example, we are waiting until network-mounted filesystems are available.Environment variables are set in the
Environment
item. SincePICO_ENGINE_HOME
is not set, the default will be used. See Configuration for the environment variables used by the pico engine.Finally,
ExecStart
is the full pathname to the executable pico engine.
Copyright Picolabs | Licensed under Creative Commons.