Tag Archives: sysadmin

Domain Expert vs Generalist

When should you use a blunt generalist tool, and when should you use a sharper domain-specific tool?

I posted a question on Serverfault recently, and received a relevant answer that wasn’t quite what I was looking for:

Systemd – How do I automatically reload a unit, when another oneshot service is fired by timer?

My reply to the answer thanked him for it, but mentioned that I think systemd is the right place to do this “sort of thing”. In reply to my reply, he told me that systemd is “absolutely the wrong place” to do this sort of thing, which is pretty strong language!

I think we’re approaching this from different perspectives here, so let’s break the problem down in general terms.

Continue reading

I Sincerely Hope I Never Write a Script like this Again

This sort of stuff destroys your soul:
[shell]
#!/bin/bash
logfile=~/slave-watcher.log

while true; do
status=$(mysql –execute=”show slave status\G”|grep “Seconds_Behind_Master:”|awk ‘{print $2}’)

if [ $status == “NULL” ]; then
mysql –execute=”show slave status\G” | grep “Last_SQL_Error:” | tee -a $logfile
mysql –execute=”set global sql_slave_skip_counter=1; start slave;”
fi

sleep 1
done
[/shell]
What it’s doing is looking at MySQL’s slave status and skipping over any statement that causes an error. There are so many reasons why you should never do this, and I won’t go into detail on what necessitated it here, but you’ll be glad to know the slave I set this loose on was not in production!