Run a node as a service
Start a node with the machine, keep it running after a crash, and control it with start, stop and status.
A node you keep in a terminal stops when the terminal closes. Install it as a service and the operating system starts it at logon or at boot, and starts it again if it stops unexpectedly. The setup wizard offers this as Start this node when the machine starts?; you can also do it at any time from the command line.
Install the service
mojoup-node service installThis registers the node with the operating system's service manager and starts it. Running it again rewrites the same definition, so it is safe to repeat.
| Option | What it does |
|---|---|
| (none) | Start the node when you log on, as you. No administrator rights needed. |
--system | Start the node at boot, before anyone logs on. Needs an administrator (Windows) or root (Linux, macOS). |
--tray | Also start the tray icon at logon (Windows only). |
The node is installed as a Scheduled Task: at logon for your user, or with --system at boot as SYSTEM (run it from an elevated terminal). The task runs hidden with no time limit. A small supervisor restarts the node if it crashes, starting at two seconds and backing off to a minute.
Ending the task in Task Scheduler stops the node too.
Control it
| Command | What it does |
|---|---|
mojoup-node start | Start the node. With no service installed, it runs the node in the background. |
mojoup-node stop | Stop it cleanly. |
mojoup-node restart | Stop it and start it again. |
mojoup-node service status | Whether the service is installed and running. |
mojoup-node status | What the node last reported, including a one-line service summary. |
mojoup-node service uninstall | Stop the node and remove what install wrote. The node's state is kept. |
start, stop and restart are the same as service start, service stop and service restart.
A clean stop lets each repository's host shut down before the node exits. If the node has not stopped after 20 seconds, it is ended.
Run in the background without a service
mojoup-node run --daemonThis starts the node detached from your terminal, with a supervisor that restarts it if it crashes. Its output goes to logs/service.log in the state directory. Stop it with mojoup-node stop.
Leave a foreground node running
When you run mojoup-node run in a terminal, the node's console opens. Leaving it asks Stop the node, or leave it running and detach?: press s to stop it, or d to stop it here and start it again in the background (as the service if one is installed, otherwise as a daemon).
The tray icon (Windows)
mojoup-node tray startThe tray icon shows whether the node is running, starting or stopped, with Start, Stop, Restart, Open dashboard, Open logs and Quit tray. The node never needs it. mojoup-node service install --tray starts it at every logon. On macOS and Linux the node has no tray icon yet.
Logs
mojoup-node logs -fThe node's log is logs/node.log in the state directory; when it runs as a service or daemon, the service manager's output is in logs/service.log.