|
Hi, I am running a homelab but since electricity is expensive here, I'd like to minimize the runtime of the machine. I already set up wake on LAN, so that whenever I try to access the server it automatically boots up and starts up copyparty (and some other stuff). To automatically shut it down, I want to create a script that periodically checks whether some of the served applications are active, and if nothing is active, shut the server down. I've already figured out how to check whether my other services are being used, but so far I was unable to find any way to see the last time copyparty was accessed in some way, short of analyzing logs. Is there some file or command I can use to check when copyparty was last accessed? |
Replies: 1 comment 1 reply
|
I ended up just analyzing logs in a super simple way... looking at the time of the last log that does not contain "PFIND" in its message lol To do that I just use this command: I have set up rsync so that my files are accessible through Dolphin, but sadly Dolphion seems to check for changes every 10 seconds. So whenever I have a dolphin tab open it basically also keeps my server powered up, unless I do that filtering. I'm using unix timestamps because it's easier to handle in bash. Just leaving this here in case someone is looking to do the same thing. |
and here is my bash script I use to determine the seconds since last access:
I'm sure you can figure out how to do a shutdown from there