Is it possible to write a System V init script (the scripts usually stored in /etc/init.d and run with service) in Perl, and have the shell recognize the #!/usr/bin/perl? Would there be any downside to doing this?

有帮助吗?

解决方案

The scripts themselves can be written in any language, but support tools may need to parse the script for metadata required to decide when the initscript will start/stop. This restricts the choices to those which can make this metadata available in the form that the tools accept.

Additionally, there may be external files written in shell script which the initscript will require in order to operate properly/efficiently/effectively. Unless these files are very simple, any parser used to read them may grow very complex.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top