--daemonize change

0 views
Skip to first unread message

Rob Lievaart

unread,
Jun 27, 2008, 5:58:55 AM6/27/08
to ram...@googlegroups.com
Hi,

I've been using the --daemonize option to start/stop ramaze, and I
found 2 things that I
did not like.

- It rewrote my start.rb file each time I started it.
- Options such as -p xxx were not passed to the actual server.

After looking through the daemons libraries sourcecode. I changed the mode used
from exec, to load. This means that the start.rb file is actually loaded by the
daemon instead of executed. So the file no longer has to be executable, and
it no longer needs the "#!/usr/bin/ruby" line at the beginning. This
way I can skip
the rewriting part.

Because the file is loaded, the current Ramaze::Global with all the commandline
options processed remains available so all options are passed on.

The only thing that gave problems were the paths to public_root and
view_root. These
are relative, and during the starting of the deamon, the current
directory is changed to
"/". So I added some code to see if these path start with a '/' (see
if they are relative or
absolute) If they are relative, I prepend the script directory to the path.

And I added the other options that te daemons library supports. The
are simply passed
through. You can now check for the status of the process wel.

The whole setup works for me. But I wonder how other users feel about
these changes.

Kind regards,


Rob Lievaart.

0002-Changed-daemonize-implementation-it-now-loads-the-s.patch
Reply all
Reply to author
Forward
0 new messages