Please note this is a FreeBSD question and not a Linux question. Please don't answer with how it would be done on Linux or systemd
or any of that.
I have a situation where memcached
is crashing. It's not that repeatable and I'll eventually figure it out. In the meantime, I need to ensure that memcached
is running. If it's not, I need to restart it. It is installed via pkg
and starts via /usr/local/etc/rc.d/memcached
. There are a few choices.
- I could write a watchdog script and invoke it every like 10 minutes or something via
cron
. Kinda ugly, but would work. Main thing here is that I need to go write that script. Callingservice memcached status
, evaluate the result, maybe callservice memcached start
. I know how to write that, but it seems clunky. I'd rather just use a mechanism that already exists. - I could write a
do ... until
loop script. Then I could modify/usr/local/etc/rc.d/memcached
. But I want to keep files that were installed by the package pristine. I don't want to perpetuate my changes each time I upgrade the package. - I drop a script into
/usr/local/etc/periodic.d/hourly
and have it invoked byperiodic(8)
.
Is there some easy, FreeBSD-native mechanism that I'm not thinking of to keep processes running? Or am I just overthinking it and I should just go write my 8 line script and start calling it from cron
?
man supervise
andman 8 supervise
both come up empty on my system. Likewisepkg search supervise
comes up empty. What am I doing wrong? – Paco Hope Aug 29 '20 at 01:18