Is there any reason a System V init script has to be written in bash? [closed]

StackOverflow https://stackoverflow.com/questions/18557806

  •  27-06-2022
  •  | 
  •  

سؤال

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