Changeset 10632 in genesis


Ignore:
Timestamp:
May 1, 2012, 11:31:33 AM (13 years ago)
Author:
rick
Message:

Heel stapel configuratie commando's, gebruik ze onder andere voor beheer#196

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/batch-cmd

    r10619 r10632  
    1212echo "# WARN: Going to run at: " $HOSTS; sleep 2
    1313
    14 cat << 'EOF' >/tmp/command
    15 sh -c ". /etc/rc.subr; load_rc_config "networking"; set" > /tmp/networking-env
    16 grep -e ^ifconfig -e ^ipv4 /tmp/networking-env
    17 { grep -e ^ipv4 /tmp/networking-env | cut -d= -f2 | tr -d \' | xargs -n1 | cut -d/ -f1;
    18   grep -e ^ifconfig /tmp/networking-env | grep -v -i 'dhcp' | cut -d= -f2 | tr -d \' | cut -d' ' -f2 | cut -d'/' -f1
    19 } | sort -u > /tmp/current
    20 ifconfig -a | grep 'inet ' | cut -d' ' -f2 | sort > /tmp/config
    21 echo "# Comparing IP differences /tmp/current vs /tmp/config"
    22 sdiff /tmp/current /tmp/config
     14##
     15## Network differences
     16##
     17#cat << 'EOF' >/tmp/command
     18#sh -c ". /etc/rc.subr; load_rc_config "networking"; set" > /tmp/networking-env
     19#grep -e ^ifconfig -e ^ipv4 /tmp/networking-env
     20#{ grep -e ^ipv4 /tmp/networking-env | cut -d= -f2 | tr -d \' | xargs -n1 | cut -d/ -f1;
     21#  grep -e ^ifconfig /tmp/networking-env | grep -v -i 'dhcp' | cut -d= -f2 | tr -d \' | cut -d' ' -f2 | cut -d'/' -f1
     22#} | sort -u > /tmp/config
     23#ifconfig -a | grep 'inet ' | cut -d' ' -f2 | sort > /tmp/current
     24#echo "# Comparing IP differences /tmp/current vs /tmp/config"
     25#diff -u /tmp/current /tmp/config
     26#EOF
     27
     28##
     29## Migrate SSH authorized_keys symlink to new location.
     30##
     31#cat <<'EOF' > /tmp/command
     32#mount -uwo noatime / && unlink /root/.ssh &&  mkdir /root/.ssh && ln -s /etc/ssh/authorized_keys /root/.ssh/ && mount -ur
     33#EOF
     34
     35##
     36## View lvrouted configured flages
     37##
     38#/usr/local/etc/rc.d/lvrouted rcvar | grep flags
     39
     40#
     41# Sync lvrouted and wl-config files
     42#
     43cat <<'EOF' > /tmp/command
     44mount -uwo noatime / || exit 1
     45trap "mount -ur /; exit 1" 1 2 3 15
     46trap "mount -ur /; exit 0" 0
     47
     48cp -v /tmp/wl-config /tools || exit 1
     49cp -v /tmp/lvrouted.in /usr/local/etc/rc.d/lvrouted || exit 1
     50cp -v /tmp/lvrouted.in /conf/base/etc/local/rc.d/lvrouted || exit 1
    2351EOF
     52
    2453
    2554# Cleanup old entries
     
    3160  : > $stdout_file
    3261  : > $stderr_file
    33   cat /tmp/command | ssh -o ConnectTimeout=3 -o BatchMode=yes root@$HOST 'cat >/tmp/command && sh /tmp/command' 1>$stdout_file 2>$stderr_file &
     62  {
     63    scp -o ConnectTimeout=3 -o BatchMode=yes /tmp/wl-config /tmp/lvrouted.in root@$HOST:/tmp
     64    cat /tmp/command | ssh -o ConnectTimeout=3 -o BatchMode=yes root@$HOST 'cat >/tmp/command && sh /tmp/command'
     65  } 1>$stdout_file 2>$stderr_file &
    3466done
    3567
Note: See TracChangeset for help on using the changeset viewer.