immortal/immortal
{ "createdAt": "2016-06-30T17:02:27Z", "defaultBranch": "master", "description": "⭕ A *nix cross-platform (OS agnostic) supervisor", "fullName": "immortal/immortal", "homepage": "https://immortal.run", "language": "Go", "name": "immortal", "pushedAt": "2024-07-21T19:15:39Z", "stargazersCount": 827, "topics": [ "daemon", "http", "nix-cross-platform", "os-agnostic", "process", "supervisor", "unix", "unix-socket" ], "updatedAt": "2025-11-18T07:37:07Z", "url": "https://github.com/immortal/immortal"}⭕ immortal
Section titled “⭕ immortal”A *nix cross-platform (OS agnostic) supervisor
Linux precompiled binaries
run on behalf other system user
Section titled “run on behalf other system user”If services need to run on behalf other system user www, nobody, www-data,
not root, immortal should be compiled from source for the desired
target/architecture, otherwise, this error may be returned:
Error looking up user: "www". user: Lookup requires cgoSee more: https://golang.org/cmd/cgo/
If using FreeBSD or macOS you can install using pkg/ports or homebrew, for other platforms work is in progress, any help for making the port/package for other systems would be appreciated.
Compile from source
Section titled “Compile from source”Setup go environment https://golang.org/doc/install
go >= 1.12 is required
For example using $HOME/go for your workspace
$ export GOPATH=$HOME/goCreate the directory:
$ mkdir -p $HOME/go/src/github.com/immortalClone project into that directory:
$ git clone git@github.com:immortal/immortal.git $HOME/go/src/github.com/immortal/immortalBuild by just typing make:
$ cd $HOME/go/src/github.com/immortal/immortal$ makeTo install/uninstall:
$ make install$ make uninstallconfiguration example
Section titled “configuration example”Content of file /usr/local/etc/immortal/www.yml:
# pkg install go-wwwcmd: wwwcwd: /usr/portslog: file: /var/log/www.log age: 10 # seconds num: 7 # int size: 1 # MegaByteswait: 1require: - foo - barIf foo and bar are not running, the service www will not be started. Skip age, num & size options to avoid log-rotation completely.
fooandbarare the names for the services defined on the same path www.yaml is located, foo.yml & bar.yml
When using immortaldir:
/usr/local/etc/immortal|--foo.yml|--bar.yml`--www.ymlThe name of the file.yml will be used to reference the service to be
daemonized excluding the extension .yml.:
foobarwww/var/run/immortal/
Section titled “/var/run/immortal/”/var/run/immortal|--foo| |-lock| `-immortal.sock|--bar| |-lock| `-immortal.sock`--www |-lock `-immortal.sockimmortal like non-root user
Section titled “immortal like non-root user”Any service launched like not using using immortaldir will follow this
structure:
~/.immortal|--(pid)| |--lock| `--immortal.sock|--(pid)| |--lock| `--immortal.sock`--(pid) |--lock `--immortal.sockThe -name argument takes a non-path (e.g., “myservice”), and the argument will be used instead of the pid in the directory structure. For example, immortal -ctl myservice sleep 1000 will be:
~/.immortal|--myservice| |--lock| `--immortal.sockThe -ctl argument takes precedence over the -name argument.
immortalctl
Section titled “immortalctl”Will print current status and allow to manage the services
pgrep -fl "immortal -ctl" | awk '{print $1}' | xargs watch -n .1 pstree -pTest status using curl & jq
Section titled “Test status using curl & jq”status:
curl --unix-socket immortal.sock http:/status -s | jqnote the single ’/’ https://superuser.com/a/925610/284722
down:
curl --unix-socket immortal.sock http://im/signal/d -s | jqup:
curl --unix-socket immortal.sock http://im/signal/u -s | jq