By default, Janus starts in foreground, and as such works as a server application that you start normally and displays output on the console. That said, there are several reasons why you may not want to keep Janus in the foreground, while still being interested in checking the console to see what's happening.

There are different ways to "daemonize" it and have it run as a service, though. This page tries to summarize a few ways to do so, starting from "dumb" approaches like sending to background and/or using screen/tmux, to more sophisticated approaches involving systemd, upstart and others.

Running Janus as a daemon

Since version 0.1.0, you can run Janus as a daemon application. To do so, just pass either -b or –daemon as a command line argument, and Janus will be daemonized. Just beware, though, that since this results in stdout/stdin/stderr being closed, you MUST specify a log file for Janus to use, either via command line (-L or –log-file ) or in janus.jcfg.

Running in background

Another simple way to run Janus in the background is to just append the & character to the command line. Anyway, this will still "flood" the console with output from Janus. While there are ways to handle it (e.g., as explained here), a nice and easy way to handle this is redirecting the output to a separate file, e.g., a dedicated log:

/opt/janus/bin/janus -d 5 -6 >/path/to/mylogfile 2>&1 &

This is especially useful in case you want to keep a log of what happened when Janus was running, and can also be used as a simple and effective way to watch the console "live" using tail:

tail -f /path/to/mylogfile

Terminal multiplexers

Another easy way to run Janus in the background is using terminal multiplexers like screen or tmux. If you're not familiar with such applications, you can find a quick overview here.

This will create a session called "janus" and launch Janus in it with a few command line options (in this case, just the option to enable IPv6 support and set the debug to verbose). Janus will then be running in the background: accessing the console is just a matter of attaching to the "janus" screen:

screen -r janus
[CTRL+A+D to detach again]

Terminal multiplexers usually allow for logging the output to file as well, if you want to keep an history of what happened during the Janus lifetime.

Remember to adjust the path in ExecStart to match the Janus binary path.

Warning

Please beware that, per the default RateLimitInterval and and RateLimitBurst values in the default sytemd configuration, logger messages are dropped if they arrive faster than ~33 per second. You may want to configure them accordingly, or otherwise Janus log messages may be missing. To fix this, setting RateLimitInterval=1s and RateLimitBurst=2000 in /etc/systemd/journald.conf is usually enough.

In case starting Janus depends on some external conditions, you may need to modify the start and stop lines accordingly. Here you can find an example, provided by @stormbkk87, showing how you can wait, for instance, for RabbitMQ to start before starting Janus too.

sysvinit

This section shows how you can add Janus as a daemon to SysVinit based systems.