2013/5/3 Chinmay Mahata <chinmay_mah...@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@.service and then you can start it as name@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
_______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel