<div dir="ltr">2013/5/3 Chinmay  Mahata <span dir="ltr"><<a href="mailto:chinmay_mahata@rediffmail.com" target="_blank">chinmay_mahata@rediffmail.com</a>></span><br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
Hi, <br><br>    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).<br>
<br>Now I have few queries (may sound like dumb questions).<br><br>1. How can I call user-defined shell(bash) functions from the service scripts in ExecStartPre and ExecStartPost sections?<br>   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.<br>
<br>....<br>EnvironmentFile=/home/me/my_functions_file<br>ExecStartPre=foo_function param1<br><br>----------<br>ExecStartPre=/bin/bash /home/me/my_functions_file; foo_function param1<br><br>----------<br>ExecStartPre=/home/me/my_functions_file<br>
ExecStartPre=foo_function param1<br><br>Nothing is working (strangely, not getting any error messages) !!!!<br></blockquote><div> </div><div style>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.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">2. How can I run multiple instances of an executable with different arguments?<br>
<br></blockquote><div style>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. <a href="http://www.freedesktop.org/software/systemd/man/systemd.unit.html">http://www.freedesktop.org/software/systemd/man/systemd.unit.html</a> has further information.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">3. How can I use user-defined signals in the service scripts?<br>
</blockquote><div style>Does <a href="http://www.freedesktop.org/software/systemd/man/systemd.kill.html">http://www.freedesktop.org/software/systemd/man/systemd.kill.html</a> help you? </div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
Please give me a few clues.<br><br>Best regards,<br>--Chinmay<br><br></blockquote><div style>Mirco </div></div></div></div>