-#!/bin/sh
-NUM=0603431329
-MAILTO=+42$NUM@sms.paegas.cz
-SAFE="tr -cd 'a-zA-Z0-9\040.:\042\043\044\055/<>(){}'"
-t=/tmp/short.step.$$
-cd
-
-sendmail() {
- (echo -n "\
-From: Step-activator <short+fromstep@ucw.cz>
-To: $MAILTO
-Content-Type: text/plain
-Content-Transfer-Encoding: 7bit
-
-$1"
- if [ -f $t ];then
- echo -n "&"
- head -n $hd $t|grep "^From:"
- fi
- )|/usr/sbin/sendmail "$MAILTO"
- rm -f $t*
- exit;
- }
-
-k332cmd () {
- echo "$1;true"|ssh -o "BatchMode yes" k332.feld.cvut.cz sh &>$t.e || \
- sendmail "ssh execute fail:`cat $t.e|$SAFE`"
- }
-
-cat >$t
-hd="$[`sed -n -e '/^\$/=' -e '/^\$/q' <$t`+1]"
-id="`tail +$hd $t|head -n 1|$SAFE`"
-[ "$id" != 0 -a "$id" != 1 ] && \
- sendmail "Command syntax:ID=$id"
-k332cmd "killall httpsd postmaster"
-if [ "$id" = 1 ];then k332cmd ". .profile &>/dev/null;./step/pgsql/bin/postmaster.run&./step/httpsd";fi
-sendmail "Ran, last res <`cat $t.e|$SAFE`>"