<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Generator" content="Microsoft Word 12 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Thanks, I did try sudo with those args instead of su with no luck. I also put the ulimit in /etc/profile outside of the if statements all together with no luck.
 Pretty confused, possible I’m over looking something obvious.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">In the mean time my colleague added ulimits in init.sh of our contextualization and that seems to have actually worked. Not sure if I like that as a solution
 permanently however.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">I think I should continue to do some investigation, I’ll mess around in one of our labs and see if I can document the changes and results for each suggestion.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Thanks,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Richard<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> users-bounces@lists.opennebula.org [mailto:users-bounces@lists.opennebula.org]
<b>On Behalf Of </b>Jaime Melis<br>
<b>Sent:</b> Monday, July 29, 2013 9:30 AM<br>
<b>To:</b> Jon<br>
<b>Cc:</b> users@lists.opennebula.org<br>
<b>Subject:</b> Re: [one-users] Issue with picking up proper ulimits during contextualization<o:p></o:p></span></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">Hi Richard,<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">did you manage to get it working?<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">regards,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Jaime<o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><o:p> </o:p></p>
<div>
<p class="MsoNormal">On Fri, Jul 26, 2013 at 3:00 PM, Jon <<a href="mailto:three18ti@gmail.com" target="_blank">three18ti@gmail.com</a>> wrote:<o:p></o:p></p>
<p class="MsoNormal">Hello Richard,<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">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.  <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">From the first line of my /etc/profile (ubuntu 13.04):<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">>> if [ "$PS1" ]; then<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">So when your context script is executed, your .bashrc is never loaded.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">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:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Instead of<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">>> su foo -l -c starman /some/app.psgi<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">I used:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">>> sudo -u foo -i starman /some/app.psgi<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Also, I recently ran into something similar in my day job, where I was attempting to execute a script over ssh:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">>> ssh root@hostname sudo <a href="http://somescript.pl" target="_blank">
somescript.pl</a><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">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:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">>> 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> "'<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">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.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">e.g.:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Instead of:<o:p></o:p></p>
</div>
<div>
<div>
<p class="MsoNormal">>> <span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#222222">su tomcatA -l -c "/var/jakarta-tomcatA/bin/startup.sh"</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#222222">try:</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#222222">>> sudo -u tomcatA -i "/var/jakarta-tomcatA/bin/startup.sh"</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#222222">or:</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#222222">>> bash -l -c 'sudo tomcatA -l "/var/jakarta-tomcatA/bin/startup.sh"'</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Anyway, hope that helps.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Best Regards,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Jon A<o:p></o:p></p>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<div>
<p class="MsoNormal">On Fri, Jul 26, 2013 at 11:43 AM, Richard Bettridge <<a href="mailto:rbettridge@blackberry.com" target="_blank">rbettridge@blackberry.com</a>> wrote:<o:p></o:p></p>
<p class="MsoNormal">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<o:p></o:p></p>
<div>
<div>
<p class="MsoNormal"><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<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal">> limits.conf to what I want and I'm explicitly adding ulimit -n 65536 to the<o:p></o:p></p>
<div>
<p class="MsoNormal">> 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>
><o:p></o:p></p>
</div>
<p class="MsoNormal">> As a test in my 90_tomcat script I'm running ulimit -a >> /tmp/tomcatsu.txt<o:p></o:p></p>
<div>
<div>
<p class="MsoNormal">><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><o:p></o:p></p>
</div>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><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><o:p></o:p></p>
</div>
<p class="MsoNormal"><br>
<br clear="all">
<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<p class="MsoNormal">-- <o:p></o:p></p>
<div>
<p class="MsoNormal">Join us at <a href="http://opennebulaconf.com/" target="_blank"><span style="color:#1155CC">OpenNebulaConf2013</span></a> in Berlin, 24-26 September, 2013<br>
--<o:p></o:p></p>
<div>
<p class="MsoNormal">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><o:p></o:p></p>
</div>
</div>
</div>
</div>
--------------------------------------------------------------------- <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.
</body>
</html>