Is it possible to use perl, python, php, ruby or whatever to write init.d scripts?

I'm new to this SysOp stuff, so I'm wondering if it's possible to use other interpreted languages to write init.d scripts?

The upfront diff for me is /bin vs. /usr/bin

#!/bin/sh

versus

#!/usr/bin/perl
#!/usr/bin/php
#!/usr/bin/python
#!/usr/bin/ruby

Are there any other points I'm missing?


Solution 1:

Yes. There are issues of availability, speed, reliability, maintainability, etc, but init scripts can be written in whatever you want.

As is implied in your question, the /usr filesystem must be mounted before you can use the interpreters residing on it.

There are Perl modules for just this task. One example is Daemon::Control, there are many more for Perl as well as the other languages.