fork()ing and fstat()ing in JRuby using FFI on linux
Sometimes, $DAYJOB can get kindof technical. For reasons I won’t go into here because NDA, the following axioms are true for this puzzle:
- we have to work in JRuby
- we are in a plugin within a larger framework providing a service
- we have to restart the entire service
- we don’t have a programmatic way to do so
- we don’t want to rely on external artifacts and cron
Now, this isn’t the initial framing set of axioms you understand; this is what we’re facing into after a few weeks of trying everything else first.
So; obvious solution, system('/etc/init.d/ourService restart')
.
Except that JRuby doesn’t do system()
. Or fork()
, exec()
, daemon()
, or indeed any kind of process duplication I could find. Oh-kay, so we can write to a file, have a cronjob watch for the file and restart the service and delete the file if it finds it.… Read the rest
Read More
Mark Dennehy in No Comments