2009年07月19日

2009年07月19日: iBook G4 不調

 自宅でプリンタ・ファイルサーバとして働いている iBook G4 が立ち上がらなくなった。印刷ができないなと思ったらフリーズしていて、電源切断で再起動しようとしたが、灰色の画面になったままリンゴマークがいつまでたっても出ない。あーこりゃマザーボード交換かな、と思って半ばあきらめていたのだが、なぜかターゲットディスクモードでは立ち上がる。まさかと思いつつも、別の Mac につないでディスクをフォーマット・再インストールしたら、ちゃんと復活してくれた。まあ今までも原因不明のフリーズは結構起きていたから、いつ壊れてもおかしくないとは思っている。ただ、本体が木の本棚の上に直接置いてあるので、放熱が悪くて熱暴走している可能性があるなと気づいたので、本体の下に空き缶のフタを置いて放熱ルートを作ってみた。冷房のない閉め切った部屋に置いてあるので、環境も悪いんだよな。

 バックアップをとってなかったので、一からセットアップのし直し。2008/12/21 付けで書いた「バックアップ用ハードディスクを定期的に入れ替える」作業の再構築に手間取ってしまった。備忘録用に、シェルスクリプトを貼付けておこう。

#!/bin/sh # Change to working directory cd /Users/xxxxx/Working # Stop AFP echo "Stopping Apple File Server at `date`" > backup.log killall -TERM AppleFileServer # Backup home directory of this machine echo "Backing up home directory at `date`" >> backup.log /Applications/CocoaRsync.app/Contents/MacOS/rsync_hfs -a -v --hfs --delete \ $HOME '/Volumes/Backup_1/Server' > rsync.log echo "rsync_hfs ended with status $?" >> backup.log # Synchronize echo "Syncing backup volumes at `date`" >> backup.log /Applications/CocoaRsync.app/Contents/MacOS/rsync_hfs -a -v --hfs --delete \ '/Volumes/Backup_1/' '/Volumes/Backup_1 1/' >> rsync.log echo "rsync_hfs ended with status $?" >> backup.log # Rsync statistics echo "Rsync statistics" >> backup.log awk ' BEGIN { del = 0; cp = 0 } /building file list/ {} /total size/ { print $0 } /^deleting / { del = del + 1; next } /^\s*$/ {} /^.*\// { cp = cp + 1; next } END { printf "%d file(s) deleted, %d file(s) copied\n", del, cp } ' < rsync.log >> backup.log # Exchange volumes echo "Exchanging backup volumes at `date`" >> backup.log if diskutil info /Volumes/Backup_1 | grep disk1 >/dev/null; then # Backup_1 is /dev/disk1 diskutil unmountDisk /dev/disk1; diskutil unmountDisk /dev/disk2 diskutil mountDisk /dev/disk2; diskutil mountDisk /dev/disk1 echo "Backup_1: /dev/disk2, Backup_1 1: /dev/disk1" >> backup.log else # Backup_1 is /dev/disk2 diskutil unmountDisk /dev/disk1; diskutil unmountDisk /dev/disk2 diskutil mountDisk /dev/disk1; diskutil mountDisk /dev/disk2 echo "Backup_1: /dev/disk1, Backup_1 1: /dev/disk2" >> backup.log fi # Enable AFP /usr/sbin/AppleFileServer echo "Starting Apple File Server at `date`" >> backup.log # Send report mail /usr/bin/ruby < backup.log -e ' require "net/smtp" s = $stdin.read s = "From: xxx@xxxx.xxx\nTo: xxx@xxxx.xxx\nSubject: Report from my server\n\n" + s Net::SMTP.start("smtp.xxxxx.xxx") { |smtp| smtp.send_mail s, "xxx@xxxx.xxx", "xxx@xxxx.xxx" } '

タグ:Mac
Posted at 2009年07月19日 00:48:05
email.png