<div dir="ltr">Hi Richard,<div><br></div><div>did you manage to get it working?</div><div><br></div><div>regards,</div><div>Jaime</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Jul 26, 2013 at 3:00 PM, Jon <span dir="ltr"><<a href="mailto:three18ti@gmail.com" target="_blank">three18ti@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello Richard,<div><br></div><div>What you are running into is the difference between an interactive shell (e.g. an ssh session) and a non-interactive shell (e.g. a startup shell).  [Depending on the distro] A default profile will check if your shell is interactive, and if so, load bashrc.  </div>


<div><br></div><div>From the first line of my /etc/profile (ubuntu 13.04):</div><div><br></div><div>>> if [ "$PS1" ]; then</div><div><br></div><div>So when your context script is executed, your .bashrc is never loaded.</div>


<div><br></div><div>In the past, I've had trouble with upstart jobs not starting Catalyst websites properly because the environment variables weren't being loaded.  The solution there was to use sudo instead of sudo:</div>


<div><br></div><div>Instead of</div><div>>> su foo -l -c starman /some/app.psgi</div><div><br></div><div>I used:</div><div>>> sudo -u foo -i starman /some/app.psgi</div><div><br></div><div>Also, I recently ran into something similar in my day job, where I was attempting to execute a script over ssh:</div>


<div><br></div><div>>> ssh root@hostname sudo <a href="http://somescript.pl" target="_blank">somescript.pl</a></div><div><br></div><div>The problem I was running into was the environment variables were not being loaded (because the shell detected it was running non-interactively), so I invoked bash directly, which loaded the environment variables, so my ssh command became:</div>


<div><br></div><div>>> ssh -t x0319t62 '/usr/bin/bash -l -c "/usr/local/bin/sudo -u foo /path/to/<a href="http://somescript.pl" target="_blank">somescript.pl</a> "'</div><div><br></div><div>As Tino said, adding your directives to /etc/profile would cause them to be loaded whenever someone logs in.  Based on your e-mail, I don't think that's exactly what you are looking for (correct me if I'm wrong), so I think one of the above solutions might work for you.</div>


<div><br></div><div>e.g.:</div><div><br></div><div>Instead of:</div><div class="im"><div>>> <span style="color:rgb(34,34,34);font-size:14.44444465637207px;font-family:Calibri,sans-serif">su tomcatA -l -c "/var/jakarta-tomcatA/bin/</span><span style="color:rgb(34,34,34);font-size:14.44444465637207px;font-family:Calibri,sans-serif">startup.sh"</span></div>


<div><span style="color:rgb(34,34,34);font-size:14.44444465637207px;font-family:Calibri,sans-serif"><br></span></div></div><div><span style="color:rgb(34,34,34);font-size:14.44444465637207px;font-family:Calibri,sans-serif">try:</span></div>


<div><span style="color:rgb(34,34,34);font-size:14.44444465637207px;font-family:Calibri,sans-serif">>> </span><span style="color:rgb(34,34,34);font-size:14.44444465637207px;font-family:Calibri,sans-serif">sudo -u tomcatA -i "/var/jakarta-tomcatA/bin/</span><span style="color:rgb(34,34,34);font-size:14.44444465637207px;font-family:Calibri,sans-serif">startup.sh"</span></div>


<div><span style="color:rgb(34,34,34);font-size:14.44444465637207px;font-family:Calibri,sans-serif"><br></span></div><div><span style="color:rgb(34,34,34);font-size:14.44444465637207px;font-family:Calibri,sans-serif">or:</span></div>


<div><span style="color:rgb(34,34,34);font-size:14.44444465637207px;font-family:Calibri,sans-serif">>> bash</span><span style="color:rgb(34,34,34);font-size:14.44444465637207px;font-family:Calibri,sans-serif"> -l -c 'sudo tomcatA -l "/var/jakarta-tomcatA/bin/</span><span style="color:rgb(34,34,34);font-size:14.44444465637207px;font-family:Calibri,sans-serif">startup.sh"'</span></div>


<div><br></div><div>Anyway, hope that helps.</div><div><br></div><div>Best Regards,</div><div>Jon A</div><div class="HOEnZb"><div class="h5"><div><br></div><div><div class="gmail_quote">On Fri, Jul 26, 2013 at 11:43 AM, Richard Bettridge <span dir="ltr"><<a href="mailto:rbettridge@blackberry.com" target="_blank">rbettridge@blackberry.com</a>></span> wrote:<br>


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I'll give it a shot, still a little confused about why it doesn't work in the contextualization's shell but works with an ssh login.  Kind of new at this stuff.<br>



<br>
<br>
Richard<br>
<div><div><br>
<br>
-----Original Message-----<br>
From: Tino Vazquez [mailto:<a href="mailto:cvazquez@c12g.com" target="_blank">cvazquez@c12g.com</a>]<br>
Sent: Friday, July 26, 2013 12:40 PM<br>
To: Richard Bettridge<br>
Cc: <a href="mailto:users@lists.opennebula.org" target="_blank">users@lists.opennebula.org</a><br>
Subject: Re: [one-users] Issue with picking up proper ulimits during contextualization<br>
<br>
Hi Richard,<br>
<br>
Reading .bashrc with 'su' (even with -l) can be sometimes a difficult<br>
task. Any chance of setting it in /etc/profile?<br>
<br>
Regards,<br>
<br>
-Tino<br>
--<br>
Constantino Vázquez Blanco, PhD, MSc<br>
Senior Infrastructure Architect at C12G Labs<br>
<a href="http://www.c12g.com" target="_blank">www.c12g.com</a> | @C12G | <a href="http://es.linkedin.com/in/tinova" target="_blank">es.linkedin.com/in/tinova</a><br>
<br>
--<br>
Confidentiality Warning: The information contained in this e-mail and<br>
any accompanying documents, unless otherwise expressly indicated, is<br>
confidential and privileged, and is intended solely for the person<br>
and/or entity to whom it is addressed (i.e. those identified in the<br>
"To" and "cc" box). They are the property of C12G Labs S.L..<br>
Unauthorized distribution, review, use, disclosure, or copying of this<br>
communication, or any part thereof, is strictly prohibited and may be<br>
unlawful. If you have received this e-mail in error, please notify us<br>
immediately by e-mail at <a href="mailto:abuse@c12g.com" target="_blank">abuse@c12g.com</a> and delete the e-mail and<br>
attachments and any copy from your system. C12G thanks you for your<br>
cooperation.<br>
<br>
<br>
On Fri, Jul 26, 2013 at 5:11 PM, Richard Bettridge<br>
<<a href="mailto:rbettridge@blackberry.com" target="_blank">rbettridge@blackberry.com</a>> wrote:<br>
> Hey,<br>
><br>
><br>
><br>
> I'm having an issue where the ulimit for open files isn't being set properly<br>
> when I spin up a process for a user during contextualization.<br>
><br>
><br>
><br>
> Upon start up of the non-persistent ubuntu 12 image, I am setting<br>
</div></div>> limits.conf to what I want and I'm explicitly adding ulimit -n 65536 to the<br>
<div>> user's .bashrc. However at the end of my 90_tomcat script when I execute the<br>
> tomcat process the ulimit is not being picked up and is set to 1024 instead<br>
><br>
><br>
><br>
</div>> As a test in my 90_tomcat script I'm running ulimit -a >> /tmp/tomcatsu.txt<br>
<div><div>><br>
><br>
><br>
> root@host002:/mnt# cat 90_tomcat |grep "su tomcatA"<br>
><br>
> su tomcatA -l -c "ulimit -a >> /tmp/tomcatsu.txt"<br>
><br>
><br>
><br>
><br>
><br>
> So this gets run at the end of 90_tomcat:<br>
><br>
> su tomcatA -l -c "ulimit -a >> /tmp/tomcatsu.txt"<br>
><br>
> su tomcatA -l -c "/var/jakarta-tomcatA/bin/startup.sh"<br>
><br>
><br>
><br>
> When I cat the txt file it says 1024:<br>
><br>
><br>
><br>
> root@host002:/etc/pam.d# cat /tmp/tomcatsu.txt |grep open<br>
><br>
> open files                      (-n) 1024<br>
><br>
><br>
><br>
> But when I log in manually as root and run /mnt/90_tomcat by hand I end up<br>
> getting the proper ulimit:<br>
><br>
><br>
><br>
> root@host002:/etc/pam.d# cat /tmp/tomcatsu.txt |grep open<br>
><br>
> open files                      (-n) 65536<br>
><br>
><br>
><br>
><br>
><br>
> Not sure what the issue but I'd appreciate any input.<br>
><br>
><br>
><br>
> Thanks,<br>
><br>
><br>
><br>
><br>
><br>
> Richard Bettridge<br>
><br>
> Systems Engineering Specialist<br>
> BlackBerry<br>
><br>
><br>
><br>
> ---------------------------------------------------------------------<br>
> This transmission (including any attachments) may contain confidential<br>
> information, privileged material (including material protected by the<br>
> solicitor-client or other applicable privileges), or constitute non-public<br>
> information. Any use of this information by anyone other than the intended<br>
> recipient is prohibited. If you have received this transmission in error,<br>
> please immediately reply to the sender and delete this information from your<br>
> system. Use, dissemination, distribution, or reproduction of this<br>
> transmission by unintended recipients is not authorized and may be unlawful.<br>
><br>
> _______________________________________________<br>
> Users mailing list<br>
> <a href="mailto:Users@lists.opennebula.org" target="_blank">Users@lists.opennebula.org</a><br>
> <a href="http://lists.opennebula.org/listinfo.cgi/users-opennebula.org" target="_blank">http://lists.opennebula.org/listinfo.cgi/users-opennebula.org</a><br>
><br>
<br>
---------------------------------------------------------------------<br>
This transmission (including any attachments) may contain confidential information, privileged material (including material protected by the solicitor-client or other applicable privileges), or constitute non-public information. Any use of this information by anyone other than the intended recipient is prohibited. If you have received this transmission in error, please immediately reply to the sender and delete this information from your system. Use, dissemination, distribution, or reproduction of this transmission by unintended recipients is not authorized and may be unlawful.<br>



_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opennebula.org" target="_blank">Users@lists.opennebula.org</a><br>
<a href="http://lists.opennebula.org/listinfo.cgi/users-opennebula.org" target="_blank">http://lists.opennebula.org/listinfo.cgi/users-opennebula.org</a><br>
</div></div></blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opennebula.org">Users@lists.opennebula.org</a><br>
<a href="http://lists.opennebula.org/listinfo.cgi/users-opennebula.org" target="_blank">http://lists.opennebula.org/listinfo.cgi/users-opennebula.org</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr">Join us at <a href="http://opennebulaconf.com/" style="color:rgb(17,85,204)" target="_blank">OpenNebulaConf2013</a> in Berlin, <span><span>24-26 September, 2013</span></span><br>

--<div>Jaime Melis<br>Project Engineer<br>OpenNebula - The Open Source Toolkit for Cloud Computing<br><a href="http://www.OpenNebula.org" target="_blank">www.OpenNebula.org</a> | <a href="mailto:jmelis@opennebula.org" target="_blank">jmelis@opennebula.org</a></div>

</div>
</div>