Disable Hugo server when running on battery power

Note that this little program can be used for lots of stuff, but to be on topic, I thought about hugo server – which actually can be fairly battery consuming (I think it’s the “file watching”). So if you have a server running “all the time”, but want to make sure it’s toggled off when you’re off the grid, so to speak:

If you have Go installed:

 go get github.com/josharian/power/nobatt

Then, assuming that $GOPATH/bin is in your PATH:

nobatt hugo server

Pretty cool.

Note that it looks like this is currently only supported for macOS.

1 Like