I'd like to check the status of a service in real-time.

I already know the command to check for example my Homebridge server:

/etc/init.d/homebridge status

When I'm debugging, I'd like to see the change of the status (for example running -> stopped) immediately.

Is there a command to keep track of this status in real-time, so I don't need to type in the command continuously?

3 Answers 3


You can use the watch utility to continuously update the status without using a loop.

watch --interval 1 'date; /etc/init.d/homebridge status'

which will update every second (the default is two seconds).

  • Thanks! This is exactly what I've looked for - a very clean solution! Sep 19, 2017 at 21:58

You can get a continuous listing of a file with tail -f. I'm not familiar with your specific service, but according what I see online, it keeps two logs at /var/log/homebridge.log and /var/log/homebridge.err. You would then get the non-error log with this complete command:

tail -f /var/log/homebridge.log

(or add sudo before the whole line if necessary given your permissions).

  • Thanks for responding Brick but I really would like to find a way getting exactly this service status in real-time, in order to do some stuff responding to this status. I already worked with the two log files and tail -f but it isn't what I need for this situation. Sep 19, 2017 at 20:31

Systemd tracks the processes attached to most persistent services, although I am not sure how well with regard to those controlled by old school SysV scripts, as homebridge appears to be.

In any case, a simple shell script like this will report that tracking information, including the point at which a process dies/exits for whatever reason.


while true; do
    systemctl status $1
    sleep 3

Call that monitor.sh and run it monitor.sh homebridge. The time reported by date will change every three seconds if nothing else does. Note this will occupy a terminal until you stop it with Ctrl-C.

  • Thanks! I just changed the script a bit and just used /etc/init.d/$1 status and it works like a charm. For following readers, don't forget to sudo chmod +x monitor.sh before running it with ./monitor.sh homebridge:-) Sep 19, 2017 at 21:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.