<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -32,6 +32,8 @@ Running
         -n, --number NUMBER              Number of handler instances
         -d, --detached                   Run as a daemon
         -P, --pidfile PIDFILE            Location to write pid file.
+        -u, --user USERNAME              The user to run as
+        -g, --group GROUP                The group to run as
     
     Commands:
       &lt;none&gt;                Start an Ernie server.
@@ -48,6 +50,11 @@ Running
         Reload the handlers for the ernie server currently running on
         port 9999.
 
+      ernie -d -p 9998 -n 5 -h calc.rb -u www-data -u www-data
+        Similar to the above command to start the ernie server, but this
+        one will run the Erlang server and the child handlers as the
+        www-data user and group.
+
 Example Handler
 ---------------
 </diff>
      <filename>README.md</filename>
    </modified>
    <modified>
      <diff>@@ -65,6 +65,16 @@ OptionParser.new do |opts|
   opts.on(&quot;-P&quot;, &quot;--pidfile PIDFILE&quot;, &quot;Location to write pid file.&quot;) do |x|
     options[:pidfile] = x
   end
+
+  opts.on(&quot;-u&quot;, &quot;--user USERNAME&quot;, &quot;The user to run as&quot;) do |x|
+    require 'etc'
+    options[:uid] = Etc.getpwnam(x).uid
+  end
+
+  opts.on(&quot;-g&quot;, &quot;--group GROUP&quot;, &quot;The group to run as&quot;) do |x|
+    require 'etc'
+    options[:gid] = Etc.getgrnam(x).gid
+  end
 end.parse!
 
 if command = ARGV[0]
@@ -86,6 +96,9 @@ else
     exit(1)
   end
 
+  Process::Sys.setgid(options[:gid]) if options[:gid]
+  Process::Sys.setuid(options[:uid]) if options[:uid]
+
   handler = options[:handler]
   port = options[:port] || DEFAULT_PORT
   number = options[:number] || 1</diff>
      <filename>bin/ernie</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>afc054579223bbda91d683bd27192ae1ec35f250</id>
    </parent>
  </parents>
  <author>
    <name>Ken Robertson</name>
    <email>ken@invalidlogic.com</email>
  </author>
  <url>http://github.com/vitaliel/ernie/commit/66902348df355112acc1b91b743acc9a7506a792</url>
  <id>66902348df355112acc1b91b743acc9a7506a792</id>
  <committed-date>2009-11-06T14:08:15-08:00</committed-date>
  <authored-date>2009-11-05T22:18:56-08:00</authored-date>
  <message>Added ability to run the erland server and handlers with set uid/gid</message>
  <tree>68bee056aa346196f97ed8a87444626f3ffde4f9</tree>
  <committer>
    <name>Vitalie Lazu</name>
    <email>vitalie.lazu@gmail.com</email>
  </committer>
</commit>
