Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 9 down vote accepted

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.

share|improve this answer
2  
I can't overstate the importance of 'availability' in this context. We write our init scripts in perl, and we've run into all manner of interesting race conditions at init time: sure, the interpreter's available, but what about perl's site_lib? What about third-party libraries it depends on (expat, zlib, that sort of thing)? The dependency tree becomes non-trivial very quickly. If you're going to go down this road, my advice is to be very cautious and use only core-bundled features of the interpreter. –  Jeff Albert Feb 7 '13 at 18:25
    
Thx bribles and @jeff-albert the point for me was if it's possible, I'm currently writing some socket server stuff and thought about why not writing the init script for that server in the same language. And yes dependency hell is everywhere... –  Lockhead Feb 7 '13 at 18:35

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.