-- MikeGore - 23 Mar 2010

SWAG.CS (was swag-new.cs)

Operation System

Machine hardware config

RAID

LOM Remote Control

Note: LOM port is disabled via ONA when not in use

BACKUP

Postgresql 8.3 to 8.4 upgrade

Backup 8.3 data

  1. ) /etc/init.d/postgresql-8.3 stop
  2. ) cd /var/lib/posgresql
  3. ) rsync -a /var/lib/posgresql/8.3 /var/lib/posgresql/8.3.orig
  4. ) rsync -a /usr/share/postgresql/8.3 /usr/share/postgresql/8.3.orig

Install *postgrsql-8.4

  1. ) apt-get install postgresql-8.4

Deleted 8.4 databases resulting from install process

  1. ) pg_dropcluster 8.4 main
  2. ) /etc/init.d/postgresql-8.4 stop

Fix pg_upgradecluster to add --disable-triggers

See http://us.generation-nt.com/answer/bug-579768-pg-upgradecluster-disable-triggers-help-197808691.html

  1. ) vi `which pg_upgradecluster`
  2. ) Near line 421 look for # start pg_restore and copy over everything
    • Update it look lik ethis:
            # start pg_restore and copy over everything
            # Updated by Mike Gore, 6Dec 2010 added --disable-triggers
            # http://us.generation-nt.com/answer/bug-579768-pg-upgradecluster-disable-triggers-help-197808691.html
                      my @restore_argv = ($pg_restore, '-h', $newsocket, '-p',
                          $newinfo{'port'},'--disable-triggers', '--data-only', '-d', $db);
            

Upgrade Databases to 8.4

  1. ) /etc/init.d/postgresql-8.3 start
  2. ) pg_upgradecluster 8.3 main

Delete old 8.3 databases

  1. ) pg_dropcluster 8.3 main
  2. ) /etc/init.d/postgresql-8.3 stop*
  3. ) apt-get remove postgresql-8.3

EMAIL

  • Email setup: UbuntuEmail
  • dpkg-reconfigure postfix
    • Type: Internet Site
    • System Mail Name: swag.cs.uwaterloo.ca
    • Root and postmaster mail recipient:
    • Other destinations to accept mail for: swag.cs.uwaterloo.cs, swag.cs, swag, localhost
    • Force synchronous updates on mail queue? : * No*
    • Local Networks: 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 129.97.0.0/16 0.0.0.0
    • Use procmail for local delivery?: Yes
    • Mailbox size limit (bytes): 0
    • Local address extension character: +
    • Internet protocols to use: ipv4

Email Aliases

  • See /etc/aliases mailing lists and groups go here

Apache

  • Install: apt-get install apache2
  • Enable userdir: a2enmod userdir
  • Restart Apache: /etc/init.d/apache2 restart

Accounts

Creation

  • adduser username (See also useradd)

Group modifications

  • usermod -a -G admin admin_user

Special Groups

  • admin
  • buahaus
  • clip
  • doppler
  • minervan
  • race
  • swag
  • web

Account migration from SWAG to SWAG-NEW.CS

  • I Created script to extract the swag users and groups we care about and build a new script to restore them in the target machine
          #!/bin/bash
          #
       
          TMP=/tmp/$$.tmp
          SCRIPT=/tmp/$$.script
       
          trap 'cleanup' 0 1 2 3 15
       
          cleanup() {
             rm -f "$TMP" "$SCRIPT"
          }
          count_comma()
          {
          awk ' BEGIN { count=0; quote=0}
              { for (i=1;i<=length($0);i++)
                {
               if(substr($0,i,1)=="\"") { quote=!quote; continue};
               if(substr($0,i,1)=="," && quote==0) {count++;}
                }
              }
               END {print count} ' $1
          }
       
       
          echo \#=========================================================== >>"$SCRIPT"
          echo \# USERS >>"$SCRIPT"
          OUR_USERS=`egrep "^[A-Za-z0-9-]+:" /etc/passwd | cut -d: -f1 | sort -u`
       
          # TMP file for groups
          for NAME in $OUR_USERS
          do
             # echo NAME=$NAME
             # Get every line that has NAME in it - cut the group name
             PUID=`egrep  "^$NAME:" /etc/passwd | cut -d: -f3`
             PGID=`egrep  "^$NAME:" /etc/passwd | cut -d: -f4`
             PHOME=`grep  "^$NAME:" /etc/passwd | cut -d: -f6`
             if [ -n $PUID -a $PUID -gt 500 -a $PUID -lt 2000 ];
             then
             SPASS=`grep  "^$NAME:" /etc/shadow | cut -d: -f2`
                echo useradd -m -d $PHOME -u $PUID -p \'"$SPASS"\' "$NAME" >>"$SCRIPT"
             fi
          done
       
          echo \#=========================================================== >>"$SCRIPT"
          echo \# GROUPS >>"$SCRIPT"
          OUR_GROUPS=`egrep "^[A-Za-z0-9-]+:" /etc/group | cut -d: -f1 | sort -u`
          #echo "$OUR_GROUPS"
       
          #Build script to create all users
          for NAME in $OUR_GROUPS
          do
             PGID=`egrep  "^$NAME:" /etc/group | cut -d: -f3`
             # Count # of group members
             PGIDS=`egrep "^$NAME:" /etc/group | cut -d: -f4- | count_comma`
             # echo PGIDS=$PGIDS
             # echo PGID=$PGID
       
             if [ -n $PGID -a $PGID -gt 500 -a $PGID -lt 2000 ];
             then
                if [ -n $PGIDS -a $PGIDS -gt 1 ];
                then
                   egrep "^$NAME:" /etc/group >>"$SCRIPT"
                fi
             fi
          done
       
          cat $SCRIPT
       
          cleanup
       
Edit | Attach | Watch | Print version | History: r19 < r18 < r17 < r16 < r15 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r19 - 2021-07-23 - MikeGore
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback