On Sat, Feb 18, 2017 at 4:46 AM, <gperr...@free.fr> wrote:
> Hello there,
> I would like to extract a part of the path of the executed script ($0) in
> a variable, e.g. if the script was run as /some/path/getty-tty1/run, I
> would like to extract "tty1" from the path, or similary, extract "dropbear"
> from /some/path/dropbear-log/run. This would allow to write templated
> services quite easily using symlinks.
The template concept does work, but with limitations. If you don't care
about portability between installations, then it is entirely possible to
use symlinks and a template script. I had tried a project very similar to
your idea, but had to halt progress on it because it did not properly
isolate settings, resulting in a portability problem; it worked for me, but
only in the environment I was running at home. The project is dormant for
the moment, but I will eventually return and re-vamp it away from templates
for portability reasons. Feel free to look around and/or borrow any ideas
from it at https://bitbucket.org/avery_payne/supervision-scripts.