[systemd-devel] Fedora 16 and upstart

Mirco Tischler mt-ml at gmx.de
Sat May 4 03:14:27 PDT 2013


2013/5/3 Chinmay Mahata <chinmay_mahata at rediffmail.com>

> Hi,
>
>     Thanks a lot, everybody for your support, for quick and valuable
> comments. So it is time for me to write the systemd service scripts (and
> bite the bullet !!! to be frank, I am not feeling much confident).
>
> Now I have few queries (may sound like dumb questions).
>
> 1. How can I call user-defined shell(bash) functions from the service
> scripts in ExecStartPre and ExecStartPost sections?
>    Like I have a shell file "/home/me/my_functions_file", inside it, there
> is a function "foo_function". I used different ways (below) in my scripts
> but all failed miserably.
>
> ....
> EnvironmentFile=/home/me/my_functions_file
> ExecStartPre=foo_function param1
>
> ----------
> ExecStartPre=/bin/bash /home/me/my_functions_file; foo_function param1
>
> ----------
> ExecStartPre=/home/me/my_functions_file
> ExecStartPre=foo_function param1
>
> Nothing is working (strangely, not getting any error messages) !!!!
>

No this won't work. Systemd is not a shell. Simply write a bash script
where you do all your stuff and then put that as the ExecStart line.


> 2. How can I run multiple instances of an executable with different
> arguments?
>
> You might be able to use template units. Name your service name at .service
and then you can start it as name at arg.service and reference arg via the %i
and %I (large i) specifiers in the ExecStart line.
http://www.freedesktop.org/software/systemd/man/systemd.unit.html has
further information.


> 3. How can I use user-defined signals in the service scripts?
>
Does http://www.freedesktop.org/software/systemd/man/systemd.kill.html help
you?


> Please give me a few clues.
>
> Best regards,
> --Chinmay
>
> Mirco
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20130504/b8dec531/attachment-0001.html>


More information about the systemd-devel mailing list