HOWTO: Run consolewd in the background

When you have installed consolewd and got it configured and running as you want you will probably want to run it as a background task so that it gets on with it’s stuff and you can use your system for other things. This is very easy to do. These instructions were tested on a Raspberry Pi Model 3B+ but they should work on most Linux based systems.

In a Pi terminal (SSH) window type:

cd /home/pi/consolewdfiles
nohup ./consolewd </dev/null &>/dev/null &

Note: Change (cd) into the directory where consolewd is installed. This might be different to the location on my Pi system.

The elements of this command are:

  • nohup - Tells Linux to keep the process running after you log out.
  • ./consolewd - The path (current directory) and name of the program you want to run in the background.
  • </dev/null - Tells Linux that there’s no ‘input’ needed to the task.
  • &>/dev/null - Tells Linux that you want to throw away any output from the task. This output is the text that scrolls up the screen when consolewd runs. The clientraw.txt and other output files are still created.
  • & - Tells Linux to run this task in the background

After running this command you’ll get a response something like:

[1] 17682

17682 is the process number for the background task that’s just been created to run consolewd.

You can check that consolewd is running in the background by typing:

ps ax | grep consolewd

You should see something like this displayed:

pi@raspberrypi:~ $ ps ax | grep consolewd
12788 ?        Ss    10:47 lsyncd /home/pi/consolewdfiles/lsyncd-wd.conf.lua
17682 ?        S      0:05 ./consolewd
17943 ?        S      0:00 /usr/bin/rsync -zstl --rsh=/usr/bin/ssh .....
17946 pts/1    S+     0:00 grep --color=auto consolewd

The line you’re looking for is the one that has ‘./consolewd’ in it…in this case you can see the same process number as above ‘17682’. Two of the other lines containing consolewd (I’ve edited it out of one line) are related to the clientraw sync process I described in another HOWTO and the ‘grep’ line is part of the ‘ps ax…’ command you typed in to get this information.

If you want to restart consolewd, e.g. to change the settings, use the ‘ps ax…’ command as above to identify the process number of the consolewd task and then use the ‘kill’ command to stop it running, e.g.

kill 17682

If you use the ‘ps ax…’ command again after killing the process you should see that the ‘./consolewd’ task has disappeared. Make your changes and then run consolewd again using the ‘nohup’ command.