Files
dt/README.md
T
2026-04-04 13:11:12 +03:00

3.7 KiB

DaemonTamer v3: a simple way to daemonize any user command

This is the third iteration of the DaemonTamer project (hence DT), a simple and straightforward user-side daemon manager. DT's only purpose is allow the users to turn any shell command into a background-running process by registering it in a special configuration file, and to manage it with a standard set of subcommands.

Previous DT iterations were written in pure POSIX shell and experimentally rewritten in Python. The current version is fully hand-written from scratch in Janet.

Functionality

DT does:

  • allow you to register any shell command to run in background,
  • change the working directory according to the service configuration,
  • run pre-start or post-stop hooks if they were specified,
  • prevent the services from double-starting,
  • allow you to specify custom paths for stdout and stderr logs,
  • persist its service configuration in a JSON file ($HOME/.dt.json),
  • provide you with the current status of any registered service or all at once.

DT does not:

  • supervise processes and/or apply any restart policy,
  • elevate or drop privileges,
  • provide any "autostart" capability upon the OS boot (it's up to the users to append corresponding dt start commands to their .profile or other autostart files).

Building and installation

Besides Git and Make, you need to jave Janet, JPM and Spork installed as the dependencies. Refer to their official documentation and the documentation of your distro.

Once ready, just run make or make static to build and then sudo make install (or sudo jpm install) to install.

Installation as a script

Alternatively, if you have Janet and Spork installed but don't want to compile the binary, you can use DT as a script like this (feel free to use any other directory in your $PATH):

sudo cp dt.janet /usr/local/bin/dt
sudo chmod +x /usr/local/bin/dt

Ready-made builds

Static DT binary builds, if any, are going to be provided in the "Releases" section for Linux/x86_64 and Linux/ARM64 platforms only.

Usage

Registering a command as a service

To register a command command under the service name servicename, run the following:

dt add servicename -c 'command' [-d workdir] [-o stdout-log-file] [-e stderr-log-file] [-b 'before-start-cmd'] [-a 'after-stop-cmd']

The parameters are:

 -a, --after-stop VALUE                      Post-stop hook command
 -b, --before-start VALUE                    Pre-start hook command
 -c, --command VALUE                         The command to run
 -d, --directory VALUE                       Working directory
 -e, --stderr-log VALUE=/dev/null            Log file for stderr (default /dev/null)
 -o, --stdout-log VALUE=/dev/null            Log file for stdout (default /dev/null)

Note that you can overwrite/update an existing service entry by providing the same service name, so be careful.

Unregistering (deleting) a service

Run dt del servicename and confirm your choice by entering y.

Getting a service status

Run dt status servicename and see whether the service is running or stopped.

Listing all services with their statuses

Run dt list. The columns will contain: service name, status, command, working directory.

Starting a service

Run dt start servicename. If available, a before-start hook command will run first.

Stopping a service

Run dt stop servicename. If available, an after-stop hook command will run after stopping.

Restarting a service

Run dt restart servicename. Identical to dt stop servicename && dt start servicename.

Credits

Created by Luxferre in 2026, released into the public domain with no warranties.