social.uhoreg.ca

September 24, 2015

personal
09:27 -0400
Hubert Chathi: Happy birthday to you / Happy birthday to you / Happy birthday, dear xkcd / Happy birthday to you
Link:http://xkcd.com/1581/
0 Comments

September 23, 2015

personal, ivan
10:32 -0400
Hubert Chathi: #Ivan yesterday to Amanda and I: "I wrote something! What does P-O-O-P spell?"
0 Comments
#Ivan

simple process respawning

work, technical
16:29 -0400

File this under "I can't believe how long it took me to figure it out".

I'm Dockerizing some of our services at work. One of them (by design) kills itself after handling a number of requests. Of course, I want it to restart after it kills itself. Most solutions seem like overkill. Using a service supervisor like runit is great, but requires too much setup for monitoring just a single process.Forever is probably a good option, but I don't want to have to install Node.js in the image just to monitor it. Not to mention, Node.js has a non-trivial memory footprint.

Basically, I want something small and simple. No extra dependencies, minimal extra setup, minimal extra resource usage. After too much time looking for a solution, I came up with a 5-line shell script:

#!/bin/sh
while :
do
"$@"
done

Name it forever.sh and put it in your PATH, and use it as: forever.sh (e.g. forever.sh server -p 8080). It's just an infinite loop that executes its arguments until it gets killed.

0 Comments

September 15, 2015

personal, ivan
11:39 -0400
Hubert Chathi: Just used Up Goer Five to show #Ivan how they landed on the moon
Link:https://xkcd.com/1133/
0 Comments
#Ivan
Later posts Earlier posts