Published on
Januar 27, 2009 in
Passenger, TextMate, general and ruby on rails.
Tags: apache, apache2, autorun, autostart, passenger, prefpane, restart, ruby, ruby on rails, textmate.
Manchmal möchte man seine Ruby-on-Rails-Applikation im Passenger manuell neu starten. Sprich eine Datei my_app/tmp/restart.txt anlegen. Ich habe ein kleines Command-Skript für TextMate dafür geschrieben. Wenn man es ausführt (in diesem Beispiel mit APFEL+R), wird beim nächsten Browseraufruf alles neu geladen. Praktisch wenn man Plugins entwickelt :)
Hier der Command in TextMate:

Und hier der Code dafür
18
19
20
21
22
23
24
| #!/usr/bin/env ruby
require "#{ENV['TM_BUNDLE_SUPPORT']}/lib/rails_bundle_tools.rb"
f = File.open File.join(RailsPath.new.rails_root, "tmp", "restart.txt"), "w"
f.close
puts "Rails Application will be reloaded!" |
Ähnliche Posts:
»
(Snow) Leopard + Rails + Passenger + VirtualBox + Windows 7 and localhost»
ActiveSupport::Memoizable Cache löschen»
Apache2 auf dem Mac macht nur 401 wegen FileVault»
MCV Ruby on Rails – was gehört wohin?
Es hat sich doch komplizierter als erwartet rausgestellt, MySQL auf Mac OS X Leopard beim booten aktiviert zu bekommen. Deshalb hier kurz der Bericht.
StartUpItems ist von Apple als “nicht empfohlen” eingestuft worden und hat bei mir auch nie funktioniert. Der PrefPane hatte nie funktioniert, es sei denn ich setze die Rechte für /usr/local/mysql auf mich selbst. Das hat wieder dazu geführt, dass launchd (also der “empfohlene” autostart von Leopard” nicht mehr klappte!
Fehlermeldung der Konsole:
1
2
3
4
5
6
7
8
9
10
| com.mysql.mysqld[4994] 080212 16:02:35 [Warning] Can't create test file /usr/local/mysql-5.0.45-osx10.4-powerpc/data/future.lower-test
com.mysql.mysqld[4994] 080212 16:02:35 [Warning] Can't create test file /usr/local/mysql-5.0.45-osx10.4-powerpc/data/future.lower-test
com.mysql.mysqld[4994] 080212 16:02:35 InnoDB: Operating system error number 13 in a file operation.
com.mysql.mysqld[4994] InnoDB: The error means mysqld does not have the access rights to
com.mysql.mysqld[4994] InnoDB: the directory.
com.mysql.mysqld[4994] InnoDB: File name ./ibdata1
com.mysql.mysqld[4994] InnoDB: File operation call: 'open'.
com.mysql.mysqld[4994] InnoDB: Cannot continue operation.
com.apple.launchd[1] (com.mysql.mysqld[4994]) Exited with exit code: 1
com.apple.launchd[1] (com.mysql.mysqld) Throttling respawn: Will start in 10 seconds |
UPDATE Mit diesem Tool kann man sehr einfach und sehr schnell alle Autostart Einträge sehen, bearbeiten und eigene erstellen.
Also, erstmal die Rechte wieder korrigieren. Dabei darauf achten, dass man nicht die Rechte vom Alias “mysql” in /usr/local korrigiert, sondern die von dem “echten” mysql verzeichnis. Also z. B. “mysql-5.0.45-osx10.4-powerpc” wäre in dem Fall VERZEICHNIS_BEI_DIR.
1
2
3
| cd /urs/local
ls -la
sudo chown -R mysql:mysql VERZEICHNIS_BEI_DIR |
Jetzt kann wie gewohnt der Launchd eingerichtet werden:
Eine Datei namens com.mysql.mysqld.plist in /Library/LaunchDaemons erstellen mit dem Inhalt:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
| < ?xml version="1.0" encoding="UTF-8"?>
< !DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Disabled</key>
<false />
<key>GroupName</key>
<string>_mysql</string>
<key>KeepAlive</key>
<true />
<key>Label</key>
<string>com.mysql.mysqld</string>
<key>Program</key>
<string>/usr/local/mysql/bin/mysqld</string>
<key>ProgramArguments</key>
<array>
<string>--user=_mysql</string>
</array>
<key>RunAtLoad</key>
<true />
<key>Umask</key>
<integer>7</integer>
<key>UserName</key>
<string>_mysql</string>
<key>WorkingDirectory</key>
<string>/usr/local/mysql</string>
</dict>
</plist> |
Dann folgende Befehle im Terminal eingeben:
1
2
3
4
5
| cd /Library/LaunchDaemons
sudo chown root com.mysql.mysqld.plist
sudo chgrp wheel com.mysql.mysqld.plist
sudo chmod 644 com.mysql.mysqld.plist
sudo launchctl load com.mysql.mysqld.plist |
Ähnliche Posts:
»
Ruby on Rails with Leopard (localhost, sites, mysql, rmagick)»
gem1.8 install mysql (MySql Ruby C bindings) in debian»
ÜÄÖß Umlaute kaputt in Ruby on Rails und MySQL [broken umlauts]»
Tiger -> Leopard = smoooth!
Kommentare