Your search query "linkto:"CommonScript"" didn't return any results. Please change some terms and refer to HelpOnSearching for more information.
(!) Consider performing a full-text search with your search terms.

Clear message

Please check the status of this specification in Launchpad before editing it. If it is Approved, contact the Assignee or another knowledgeable person before making changes.


This specification aims at providing a way to set up an environment for all scripts in a job file. This is done by adding a script section containing a shell script that will be executed before any other script.


This feature is needed because if someone wants to define a shell function or a variable that will be used in all the scripts of a job file, he/she will need either to copy the declaration at the beginning of all scripts or will need to put these declarations in another file and source it at the beginning of each script. The solution proposed here will simplify hat by not having to copy and paste the same code many times.

Use cases



It will be possible to write scripts inside a new section that begins with common script and ends with end script. This script will be executed before any other script and in the same environment. For example:

common script
    source /etc/rc.conf
end script

post-start script
    for if in $INTERFACES; do
        ifup $if
end script



No idea ... sorry.

ScottJamesRemnant: not that difficult, it could be done by simply concatenating the scripts in job_run_process, it may be easier if we force the /dev/fd/NNN trick, but it's possible either way.

Data preservation and migration

These changes are backwards compatible with the previous behaviour.

Unresolved issues

Maybe it could be possible to add a common script that will be sourced after any other script that would for example clean temporary files created in the common script that ran at the beginning. But it is not necessary because this cleanup can be written in a shell function that is easily called at the end of all other scripts.

ScottJamesRemnant: interaction with exec?