使用Upstart配置中的功能

时间:2016-10-25 18:25:20

标签: bash upstart

我正在编写一个upstart配置文件。在其中,我有一个预启动脚本,一个脚本和一个预停止脚本节。其中每个都有大量相同的代码。因此,我尝试将此代码重构为一些bash函数。但是,在这样做的过程中,我发现“人们不会简单地在upstart配置文件中编写bash”。不允许使用bash stream关键字,因为它被解释为一个节,并且它不是有效的新手节。

function

如果我必须将每个函数的内容复制粘贴到上面的节中,我真的想避免存在那种代码重复。如何将一些bash命令干掉到一个公共位置并让我的每个# Some header stanzas that are boring ... env ONE_OF_A_FEW_VARIABLES ... function an_illegal_function () {...} pre-start script function_call_A function_call_B end script script function_call_A function_call_C echo "I love pie." end script pre-stop script function_call_B function_call_C end script 节引用它们?

0 个答案:

没有答案