<div dir="ltr"><div class="gmail_default" style="font-family:"times new roman",serif;font-size:large">Andrei,</div><div class="gmail_default" style="font-family:"times new roman",serif;font-size:large"><br></div><div class="gmail_default" style="font-family:"times new roman",serif;font-size:large">How to set SYSTEMD_UNIT_PATH in Systemd ?</div><div class="gmail_default" style="font-family:"times new roman",serif;font-size:large"><br></div><div class="gmail_default" style="font-family:"times new roman",serif;font-size:large">I checked about systemd source code in github. Please see this link</div><div class="gmail_default" style="font-family:"times new roman",serif;font-size:large"><br></div><div class="gmail_default"><font face="times new roman, serif" size="4"><a href="https://github.com/search?q=org%3Asystemd+systemd_unit_path&type=Code">https://github.com/search?q=org%3Asystemd+systemd_unit_path&type=Code</a></font><br></div><div class="gmail_default"><font face="times new roman, serif" size="4"><br></font></div><div class="gmail_default" style="font-family:"times new roman",serif;font-size:large">Even in these source files they are doing getenv and setenv for SYSTEMD_UNIT_PATH. I dont see any conf file using which we can configure the environment variable. <br></div><div class="gmail_default" style="font-family:"times new roman",serif;font-size:large"><br></div><div class="gmail_default" style="font-family:"times new roman",serif;font-size:large"><br></div><div class="gmail_default" style="font-family:"times new roman",serif;font-size:large">Regards,</div><div class="gmail_default" style="font-family:"times new roman",serif;font-size:large">Raghu.</div><div class="gmail_default" style="font-family:"times new roman",serif;font-size:large"><br></div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><font style="font-family:times new roman,serif" size="2"></font><font face="times new roman,serif"><font size="4">--<br>Regards,<br><br>Raghavendra. H. R<br>(Raghu)</font><br></font></div></div></div></div>
<br><div class="gmail_quote">On Mon, Sep 26, 2016 at 1:59 PM, Andrei Borzenkov <span dir="ltr"><<a href="mailto:arvidjaar@gmail.com" target="_blank">arvidjaar@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Mon, Sep 26, 2016 at 10:59 AM, Raghavendra. H. R <<a href="mailto:raghuhr84@gmail.com">raghuhr84@gmail.com</a>> wrote:<br>
> These are instructions which I tried.<br>
><br>
> mkdir -p /BingoDast<br>
> mount -t nfs -o nolock <ip_address>:/tftpboot/raghu/<wbr>BingoDast /BingoDast<br>
><br>
> export PATH=$PATH:/BingoDast/bin<br>
> export LD_LIBRARY_PATH=$LD_LIBRARY_<wbr>PATH:/BingoDast/lib<br>
> export SYSTEMD_UNIT_PATH=/BingoDast/<wbr>units<br>
> echo $SYSTEMD_UNIT_PATH<br>
> /BingoDast/units<br>
><br>
> systemctl start bingod.service<br>
> Failed to start bingod.service: Unit bingod.service failed to load: No such<br>
> file or directory.<br>
><br>
<br>
</span>SYSTEMD_UNIT_PATH has to be set in environment of systemd, not systemctl.<br>
<div class="HOEnZb"><div class="h5"><br>
> Other options which I tried for setting SYSTEMD_UNIT_PATH are given below.<br>
><br>
> 1. Just gave the environment variable directly on the console<br>
>  SYSTEMD_UNIT_PATH=/BingoDast/<wbr>units<br>
><br>
> 2. Gave the environment variable along with DefaultEnvinronment tag<br>
>  DefaultEnvironment=SYSTEMD_<wbr>UNIT_PATH=/BingoDast/units<br>
><br>
><br>
> Regards,<br>
> Raghu<br>
><br>
><br>
> --<br>
> Regards,<br>
><br>
> Raghavendra. H. R<br>
> (Raghu)<br>
><br>
> On Mon, Sep 26, 2016 at 1:07 PM, Andrei Borzenkov <<a href="mailto:arvidjaar@gmail.com">arvidjaar@gmail.com</a>><br>
> wrote:<br>
>><br>
>> On Mon, Sep 26, 2016 at 10:06 AM, Raghavendra. H. R <<a href="mailto:raghuhr84@gmail.com">raghuhr84@gmail.com</a>><br>
>> wrote:<br>
>> > But SYTEMD_UNIT_PATH isn't working. I added my executables path for this<br>
>> > env<br>
>> > variable but whatever I add isn't reflected for this variable. If I do<br>
>> > echo<br>
>><br>
>> Repeating this 100 times won't make it more clear. I already asked you<br>
>> to paste exact commands and their output that you used to "add your<br>
>> path for this env variable".<br>
>><br>
>> > of $SYSTEMD_UNIT_PATH. Its all empty. My executables are not able to<br>
>> > find<br>
>> > the path and it is not running.<br>
>> ><br>
>> > --<br>
>> > Regards,<br>
>> ><br>
>> > Raghavendra. H. R<br>
>> > (Raghu)<br>
>> ><br>
>> > On Thu, Sep 22, 2016 at 12:26 PM, Andrei Borzenkov <<a href="mailto:arvidjaar@gmail.com">arvidjaar@gmail.com</a>><br>
>> > wrote:<br>
>> >><br>
>> >> On Thu, Sep 22, 2016 at 9:18 AM, Raghavendra. H. R<br>
>> >> <<a href="mailto:raghuhr84@gmail.com">raghuhr84@gmail.com</a>><br>
>> >> wrote:<br>
>> >> > Thank you for the suggestions.<br>
>> >> > But with this suggestion i.e., generator file, I again need to<br>
>> >> > add/modify<br>
>> >> > some files.<br>
>> >> ><br>
>> >><br>
>> >> You need to add/modify some files to implement your service anyway. I<br>
>> >> do not see how one more file is a problem so far.<br>
>> >><br>
>> >> > All I'm looking into is I mount my binaries and unit files under<br>
>> >> > /mnt.<br>
>> >> > By<br>
>> >> > setting any environment variable like SYSTEMD_UNIT_PATH, systemd<br>
>> >> > should<br>
>> >> > pick<br>
>> >> > the unit files from /mnt and execute my binaries as per the<br>
>> >> > instructions<br>
>> >> > given in unit file.<br>
>> >> ><br>
>> >><br>
>> >> Which is exactly what it does. You just need to set variable in<br>
>> >> environment of systemd.<br>
>> >><br>
>> >> > In normal init.d systems, we have environment variables like PATH &<br>
>> >> > LD_LIBRARY_PATH.<br>
>> >> > No matter where I place my new executable or library, adding new path<br>
>> >> > into<br>
>> >> > these environment variables is enough to execute or link the library.<br>
>> >> ><br>
>> >> > Probably this kind of facility is not available in Systemd init<br>
>> >> > systems.<br>
>> >> ><br>
>> >> > --<br>
>> >> > Regards,<br>
>> >> ><br>
>> >> > Raghavendra. H. R<br>
>> >> > (Raghu)<br>
>> >> ><br>
>> >> > On Wed, Sep 21, 2016 at 10:40 PM, Andrei Borzenkov<br>
>> >> > <<a href="mailto:arvidjaar@gmail.com">arvidjaar@gmail.com</a>><br>
>> >> > wrote:<br>
>> >> >><br>
>> >> >> <a href="tel:21.09.2016%2014" value="+12109201614">21.09.2016 14</a>:26, Raghavendra. H. R пишет:<br>
>> >> >> > Hi,<br>
>> >> >> ><br>
>> >> >> > I'm newbie with systemd boot system and I need help in resolving<br>
>> >> >> > one<br>
>> >> >> > issue.<br>
>> >> >> ><br>
>> >> >> > I would like to create a service under a customized path Eg:/mnt<br>
>> >> >> > and<br>
>> >> >> > systemd should be able to pick my unit file from this.<br>
>> >> >> ><br>
>> >> >> > I tried by setting *Environment=SYSTEMD_UNIT_<wbr>PATH=/mnt *from the<br>
>> >> >> > console<br>
>> >> >><br>
>> >> >> This should be set in environment of srarted systemd, which in case<br>
>> >> >> of<br>
>> >> >> systemwide init effectively means either you need to use some<br>
>> >> >> wrapper<br>
>> >> >> to<br>
>> >> >> set it and exec systemd or hack initrd.<br>
>> >> >><br>
>> >> >> Also SYSTEMD_UNIT_PATH does not really play nicely with priorities<br>
>> >> >> of<br>
>> >> >> unit locations (run-time vs. sysadmin vs. shipped).<br>
>> >> >><br>
>> >> >> May be it is simpler to install generator that copies your unit<br>
>> >> >> definition in standard location. This guarantees it is available<br>
>> >> >> before<br>
>> >> >> systemd starts.<br>
>> >> ><br>
>> >> ><br>
>> ><br>
>> ><br>
><br>
><br>
</div></div></blockquote></div><br></div>