From 3c37f39987545e322eb7ea3dd630904d13519672 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Sun, 3 Jun 2007 18:38:15 +0000 Subject: [PATCH] Committing all changes before migrating servers --- bin/away-actions | 12 ++++++------ bin/critical-backup | 18 ++++++++++-------- perl/away-tpope | 6 ++---- perl/sct6 | 15 +++++++++++++-- 4 files changed, 31 insertions(+), 20 deletions(-) diff --git a/bin/away-actions b/bin/away-actions index 30ad0e4..8515027 100755 --- a/bin/away-actions +++ b/bin/away-actions @@ -9,7 +9,7 @@ PATH="$HOME/bin:/usr/bin:/bin" ssh="ssh -a -x -oBatchmode=yes -oSetupTimeOut=20" ulimit -S -u 96 -br=lucille +br="tpope br" if [ -f /tmp/away-actions.pid ]; then oldpid="`cat /tmp/away-actions.pid`" @@ -19,7 +19,7 @@ if [ -f /tmp/away-actions.pid ]; then newpid="`cat /tmp/away-actions.pid`" [ "$newpid" = "$oldpid" ] && kill "$newpid" sleep 1 - if [ -f /tmp/away-actions.pid && "`cat /tmp/away-actions.pid`" = "$oldpid" ]; then + if [ -f /tmp/away-actions.pid && "x`cat /tmp/away-actions.pid`" = "x$oldpid" ]; then kill -9 "$oldpid" rm /tmp/away-actions.pid elif [ -f /tmp/away-actions.pid ]; then @@ -53,15 +53,15 @@ esac find /tmp -name .tpope_lights -maxdepth 1 -mmin 60 -exec rm {} \; if [ "$is_away" = 1 -a ! -f /tmp/.tpope_lights ]; then touch /tmp/.tpope_lights - $ssh $br br -F -F + $br -F -F ulimit -S -u 92 for host in buster; do ping -c 1 $host >/dev/null && $ssh $host tpope xssc -lock 2>/dev/null & done elif [ "$is_away" = 0 -a -f /tmp/.tpope_lights ]; then - $ssh $br br -n 4 + $br -n 4 rm -f /tmp/.tpope_lights - $ssh $br br -n 4 + $br -n 4 ulimit -S -u 92 # for host in lucille; do # ping -c 1 $host >/dev/null && $ssh $host tpope unlock @@ -84,7 +84,7 @@ else echo "$information" > "$HOME/.plan" fi -for host in gob barry lucille buster oscar; do +for host in michael lucille buster oscar; do ping -c 1 $host >/dev/null && scp -q "$HOME/.status" $host: 2>/dev/null done diff --git a/bin/critical-backup b/bin/critical-backup index 5b63a38..eabcca8 100755 --- a/bin/critical-backup +++ b/bin/critical-backup @@ -21,17 +21,16 @@ chmod 0700 /tmp/.critical-$LOGNAME-$$ sync-tpope -g -a /tmp/.critical-$LOGNAME-$$/tpope.tar cd /tmp/.critical-$LOGNAME-$$ ln -s "$HOME/.cvs" cvs +ln -s /var/lib/svn svn mysqldump --all-databases > mysqldump.sql -tar chf - tpope.tar cvs mysqldump.sql |\ +tar chf - tpope.tar cvs svn mysqldump.sql |\ gpg -qez 9 -r "$GPGID" --batch --no-tty > $ARCHIVE [ -d "$HOME/backup-`date +%Y`" ] || mkdir "$HOME/backup-`date +%Y`" cp $ARCHIVE "$HOME/backup-`date +%Y`/" -scp -Bq -oSetupTimeout=30 $ARCHIVE patman:backup/ 2>/dev/null || \ -scp -Bq -oSetupTimeout=30 $ARCHIVE chief:backup/ 2>/dev/null -scp -Bq -oSetupTimeout=30 $ARCHIVE right:backup/ 2>/dev/null -scp -Bq $ARCHIVE snowball:tpope.tar.gpg 2>/dev/null +scp -Bq -oSetupTimeout=30 $ARCHIVE tpope-486.jmwaller.com:backup/ 2>/dev/null +scp -Bq $ARCHIVE steve:tpope.tar.gpg 2>/dev/null d="`date +%d`" if [ "$d" = 01 -o "$d" = 08 -o "$d" = 16 -o "$d" = 23 -o "$1" = "-m" ]; then @@ -42,7 +41,9 @@ if [ "$d" = 01 -o "$d" = 08 -o "$d" = 16 -o "$d" = 23 -o "$1" = "-m" ]; then -a "From: $FROM" fi -if [ "`date +%m%d`" = "0101" -o "$1" = "-c" ]; then +if true; then + : +elif [ "`date +%m%d`" = "0101" -o "$1" = "-c" ]; then mkisofs -r -J -o back.iso "$HOME/backup-`date +%Y`" 2>/dev/null if ! sudo cdrecord -tao -data -multi speed=4 back.iso 2>/dev/null; then echo "Error: blank CD not found. Please call `basename $0` manually" >&2 @@ -58,9 +59,10 @@ elif [ "`date +%m%d`" = "1231" ]; then echo "Yearly backup finished. Please put a blank CD in the drive." >&2 elif [ "$d" = 01 -o "$d" = 08 -o "$d" = 16 -o "$d" = 23 ]; then s="`sudo cdrecord -msinfo 2>/dev/null`" + echo "s=$s" if [ "$s" ]; then - mkisofs -r -J -o back.iso -M /dev/cdr -C "$s" "$HOME/backup-`date +%Y`" 2>/dev/null - sudo cdrecord -tao -data -multi speed=4 back.iso >/dev/null 2>&1 || \ + mkisofs -r -J -o back.iso -M /dev/cdr -C "$s" "$HOME/backup-`date +%Y`" + sudo cdrecord -tao -data -multi speed=4 back.iso || \ echo "CD burning failed." >&2 else echo "Error. Is the CD in the drive?" >&2 diff --git a/perl/away-tpope b/perl/away-tpope index e4e7adb..a82fb84 100755 --- a/perl/away-tpope +++ b/perl/away-tpope @@ -195,9 +195,7 @@ sub do_chat { } sub eval_chat { - if(($state{'chat'}||'') eq "jmwaller" || ($state{'chat'}||'') eq "arwen") { - internal_out("Work",3*60*60); - } elsif(($state{'chat'}||'') =~ /^tpope-\d+$/) { + if(($state{'chat'}||'') =~ /^(tpope-\d+|jmwaller|arwen|george)$/) { internal_out("Work",3*60*60); } elsif(($state{'chat'}||'') eq "accd") { #internal_out("School",30*60); @@ -245,7 +243,7 @@ sub is_alive { eval { local $SIG{ALRM} = sub { die "alarm\n" }; alarm(30); - $ret=!(system(@ssh,shift, 'if pidof xscreensaver >/dev/null && DISPLAY=:0.0 xscreensaver-command -version >/dev/null 2>&1; then if DISPLAY=:0.0 xscreensaver-command -time 2>&1 |egrep "non-blanked|no saver status" >/dev/null; then true; else pid=`ps ax|egrep "[0-9]:[0-9][0-9] ssh michael .*(screen.*RR irc|Chat)"|sed -e "s/^ *//"|cut -d" " -f 1`; [ -f "$HOME/.irc.lock" -o -z "$pid" ] || kill $pid; false; fi; else false; fi') >> 8); + $ret=!(system(@ssh,shift, 'if pidof xscreensaver >/dev/null && DISPLAY=:0.0 xscreensaver-command -version >/dev/null 2>&1; then if DISPLAY=:0.0 xscreensaver-command -time 2>&1 |egrep "non-blanked|no saver status" >/dev/null; then true; else pid=`ps ax|egrep "[0-9]:[0-9][0-9] ssh gob .*(screen.*RR irc|Chat)"|sed -e "s/^ *//"|cut -d" " -f 1`; [ -f "$HOME/.irc.lock" -o -z "$pid" ] || kill $pid; false; fi; else false; fi') >> 8); alarm(0); }; if($@) { diff --git a/perl/sct6 b/perl/sct6 index 3682c39..5295a0e 100755 --- a/perl/sct6 +++ b/perl/sct6 @@ -89,9 +89,20 @@ $ua = LWP::UserAgent->new; $ua->timeout(10); $ua->env_proxy; $ua->cookie_jar( {} ); -$ua->get("${url}twbkwbis.P_WWWLogin") or die "$!"; +$response = $ua->get("${url}twbkwbis.P_WWWLogin") or die "$!"; $response = $ua->post("${url}twbkwbis.P_ValLogin", { sid => $opts{SID}, PIN => $opts{PIN} }) or die "$!"; +my %hiddenjunk; +{ + my $content = $response->content; + while($content =~ //gi) { + $hiddenjunk{$1} = $2; + } +} +$hiddenjunk{usage_btn} = "Continue"; +$response = $ua->post("${url}twbkwbis.P_FirstMenu", \%hiddenjunk); +die $response->status_line unless $response->is_success; + $response = $ua->get("${url}bwskflib.P_SelDefTerm"); # Valid terms die $response->status_line unless $response->is_success; my @terms = grep {s/^