Way to autoshutdown when clients offline

Hi,

can you help me to implement a autoshutdown script when a specific amount of clients is offline?

I am using dietpi 6.19.7 on a nativ pc system. When I do a “shutdown -now” the system goes down and with a wol it wakes up. Perfectly! I use this system as a LMS (Logitech Media Server) with 4 clients (picoreplayer with raspberry pis)

Now I need a skript to “shutdown -now” when non of the 4 clients is online.

Can you help me?

Greetings Elluminatus

Elluminatus
Interesting aim, makes sense for pure media server machine, besides you will face the boot delay when starting a client.

You could add a cron job to regularly check for active clients. However I am not sure how these can be checked. Perhaps there is a Plex CLI command to do this, or simply check active network connections for the related client IPs/hostnames in general?