You're viewing all posts tagged with admin

Reinstalling git on Snow Leopard

If you are reinstalling git for Snow Leopard, don’t forget to nuke MacPorts. Leaving an old version on your machine will cause the git compile process to spit out various incorrect architecture errors:

ld: warning: in /opt/local/lib/libz.dylib, file is not of required architecture
ld: warning: in /opt/local/lib/libiconv.dylib, file is not of required architecture

Remove MacPorts with the terrifyingly brutal:

sudo rm -rf \
    /opt/local \
    /etc/manpaths.d/macports \
    /etc/paths.d/macports \
    /Applications/DarwinPorts \
    /Applications/MacPorts \
    /Library/LaunchDaemons/org.macports.* \
    /Library/Receipts/DarwinPorts*.pkg \
    /Library/Receipts/MacPorts*.pkg \
    /Library/StartupItems/DarwinPortsStartup \
    /Library/Tcl/darwinports1.0 \
    /Library/Tcl/macports1.0

Once you have removed MacPorts, the compile process should be as easy as:

make configure 
./configure --prefix=/usr/local
make prefix=/usr/local all
sudo make prefix=/usr/local install

git config --global user.name "[user.name]" 
git config --global user.email "[user.email]"

And when you are done, don’t forget this little gem for adding pretty colours to your git output:

git config --global color.ui "auto"

MySQL Remote Database Transfers

One-liner to remote copy a MySQL database over SSH:

mysqldump [db] | ssh -C [host] 'mysql [db]'

For anything more complicated there is also taps.

Setting The Default Java Virtual Machine On Ubuntu

Select the default Ubuntu JVM with update-alternatives:

sudo update-alternatives --config java

Monit And My Sql

Usually Monit will be happy to watch MySQL with the following configuration:

check process mysqld with pidfile "/var/run/mysqld/mysqld.pid"
  group database
    start program = "/etc/init.d/mysql start"
    stop program = "/etc/init.d/mysql stop"
    if cpu > 60% for 2 cycles then alert
    if cpu > 80% for 10 cycles then restart
    if failed port 3306 protocol mysql then restart

If you are getting connection refused errors, your MySQL database may not be bound to localhost. Check your bind address in /etc/mysql/my.cnf:

bind-address = 0.0.0.0

If the address MySQL is bound to is external, you will need to adjust your monitrc accordingly:

if failed host 0.0.0.0 port 3306 protocol mysql then restart