Archiv vom Juli 2007

Rails FCGID dispatcher finder

Vom 7. Juli 2007

Another English post because this might come in handy for some people out there. Some Rails programmers out there may know the problem:

When updating your production server you’ve just run svn update to update the source of your Rails application. Because of cached code it is also necessary to restart the dispatchers of the Rails application.

Well, I have to admit, until now I simply restarted the Apache2 webserver or killed all dispatcher processes (killall dispatch.fcgi). However since there are quite a few Rails apps running on my server this always killed the other dispatchers, too. This isn’t really a problem but more of “unnecessary brute force”. The perfect solution would be to find the exact dispatcher of the Rails application I want to update and just kill this one.

But how? ps -A | grep dispatch.fcgi only prints out the PIDs of the dispatchers but not the paths. To work around this and I created a little script: find_dispatcher.rb

It analyses the Apache log file and shows the data of every log entry where an FCGID dispatcher was started.

ruby find_dispatcher.rb
1722    Fri Jul 06 18:59:01 2007  /path/to/project/a/public/dispatch.fcgi
1755    Fri Jul 06 19:11:52 2007  /path/to/project/b/public/dispatch.fcgi
4615    Sat Jul 07 14:49:14 2007  /path/to/project/c/public/dispatch.fcgi
4931    Sat Jul 07 16:20:30 2007  /path/to/project/d/public/dispatch.fcgi

It’s possible to specify a filter to just see the dispatchers created for a single project:

ruby find_dispatcher.rb -f project/b
1755    Fri Jul 06 19:11:52 2007  /path/to/project/b/public/dispatch.fcgi

To combine this script with others the --only-last-pid (or -p) option just prints out the last PID:

ruby find_dispatcher.rb -f project/b -p
1755

By default the script searches the /var/log/apache2/error.log file for matching entries. You can specify your own log file with the --log (-l for short) option.

ruby find_dispatcher.rb --log /my/own/log/file.log

This is it. --help will show an overview of all options. You can get the script directly out of my SubVersion repository: find_dispatcher.rb. Much fun with it.

UPDATE: I just found out that ps -Af also prints the path to the processes. Together with grep it’s no deal to get the PID of a specific dispatcher (eg. ps -Af | grep collaboa). This makes the script a bit useless. However it can be still interesting to know when your dispatchers where started.

At least it was an exciting programming practice. :)

Abgelegt in: Programmieren, Projekte, Helion | Kommentare ansehen und hinterlassen

Langeweile, neues Skype

Vom 2. Juli 2007

Mir ist gerade etwas langweilig, während der Helion Webserver gerade SubVersion neue kompiliert bzw. die Ruby bindings prüft (zum x-ten mal heute). Ist aber eine andere Geschichte…

Seit gestern genieße ich die Vorzüge der neuen Skype Version 1.4 für Linux (noch Beta). Ich muss wirklich sagen, dass mich dieses Update sehr beeindruckt hat. Es passt sehr viel besser in den Gnome Desktop, die Bedienung ist einfacher und angenehmer und: es schaut besser aus. :)

Hab vor ein paar Tagen einen Überblick über die kommende Opera-Version 9.5 gelesen. Dort stand auch, dass sie nun Qt 4 verwenden und sich dadurch Opera sehr viel besser in Linux-Desktops einfügt. Für normale Menschen: Qt ist eine C++ Bibliothek, womit man plattformübergreifend Benutzeroberflächen programmieren kann.

Ich schätze mal, dass ein guter Teil des Skype-Updates auf die Nutzung von Qt 4 zurückgeht. Wenn das so ist, dann bin ich mal auf die neue Opera-Version gespannt.

Sehe gerade, dass der Helion Webserver fertig geackert hat. Werde dann mal weiter machen und hoffentlich noch ein paar Stunden Schlaf bekommen.

ps.: Der Helion Webserver ist durch ein neues SubVersion-Modul jetzt auch etwas schneller geworden. Die Zeit hat sich alleine deshalb schon gelohnt.

Abgelegt in: Browser, Helion | Kommentare ansehen und hinterlassen (2)

Projekte

Simple Localization
Ein einfaches, aber macht- volles Übersetzungsplugin für Ruby on Rails.
Table Navigation
Ein jQuery Plugin um per Tastatur schnell durch Tabellen zu navigieren.

Über was ich schreibe…

Newsfeeds

Kommentare