![]() |
HowTo.Raid1DiversionScripts HistoryHide minor edits - Show changes to markup July 07, 2006, at 10:09 PM
by -- fixed syntax error - L should have been -L in the test statement
Changed lines 55-56 from:
[ - L /root ] || ln -sf /opt/user/root /root to:
[ -L /root ] || ln -sf /opt/user/root /root January 22, 2006, at 12:40 PM
by -- change /opt/root to /opt/user/root in rc.1
Changed lines 55-56 from:
[ - L /root ] || ln -sf /opt/root /root to:
[ - L /root ] || ln -sf /opt/user/root /root August 29, 2005, at 04:50 PM
by -- New diversion scripts for 4 partition raid
Changed line 7 from:
to:
Changed line 10 from:
to:
Added line 12:
/bin/sleep 2 Changed lines 18-21 from:
to:
/bin/mount -t ext3 /dev/md4 /share/hdd/data/public -o rw,noatime /bin/mount /share/hdd/data/public /public -o bind Added lines 36-46:
/bin/echo "Creating ramfs for /var:" /bin/mount -t ramfs ramfs /mnt/tmpmnt -o maxsize=256 /bin/cp -rp /var/* /mnt/tmpmnt/ /bin/mkdir -p /var.state /bin/mount -o bind /var /var.state /bin/mount -o bind /mnt/tmpmnt /var /bin/umount /mnt/tmpmnt Deleted lines 56-64:
if ( [ -f /.ext3flash ] ) ; then /bin/echo "Remounting /dev/sda1 as ext3flash:" /bin/mount -o remount,rw,noatime /dev/sda1 /bin/echo "Remounting /dev/sda2 as ext3flash:" /bin/mount -o remount,rw,noatime /dev/sda2 /bin/echo "Removing swap from ext3flash:" /sbin/swapoff /dev/sda3 fi Deleted lines 64-68:
if ( [ ! -f /.sda1root ] && [ ! -f /.sda2root ] && [ ! -f /.sdb1root ] && [ ! -f /.sdb2root ] ) ; then /bin/echo "Creating ramfs for /tmp:"; mount -t ramfs none /tmp -o maxsize=512 fi /bin/rm -rf /tmp/* /mnt/backup/* /bin/chmod 1777 /tmp Changed lines 76-77 from:
return 0 =] to:
return 0=] Changed lines 86-87 from:
to:
/bin/cp /etc/passwd /opt/etc/passwd Added lines 108-109:
/bin/umount /share/hdd/data/public 2>/dev/null /bin/umount /public 2>/dev/null Changed lines 117-121 from:
/opt/sbin/mdadm -S /dev/md3 /opt/sbin/mdadm -S /dev/md2
/opt/sbin/mdadm -S /dev/md1 to:
/opt/sbin/mdadm -Ss --config=/opt/etc/mdadm.conf Changed line 122 from:
to:
/bin/mount -o remount,ro /dev/root / Changed lines 126-135 from:
cd /initrd /sbin/pivot_root . initrd exec /usr/sbin/chroot . /etc/rc.d/rc.reboot
/bin/echo "should never reach here..." /opt/sbin/mdadm -S /dev/md1 2>/dev/null
to:
Changed lines 138-139 from:
cd / to:
chdir / /bin/cp /etc/passwd /opt/etc/passwd Changed lines 142-144 from:
to:
/bin/killall sshd 2>/dev/null /opt/etc/init.d/S80thttpd stop Changed lines 146-147 from:
/bin/sleep 4 to:
/bin/killall crond 2>/dev/null Added lines 157-159:
/usr/bin/quotaoff -a Added lines 165-166:
/bin/umount /var.state 2>/dev/null /bin/umount /var 2>/dev/null Added lines 168-169:
/bin/umount /share/hdd/data/public 2>/dev/null /bin/umount /public 2>/dev/null Changed lines 179-181 from:
/opt/sbin/mdadm -S /dev/md3 /opt/sbin/mdadm -S /dev/md2 /opt/sbin/mdadm -S /dev/md1 to:
/opt/sbin/mdadm -Ss --config=/opt/etc/mdadm.conf Deleted lines 188-192:
cd /initrd /sbin/pivot_root . initrd exec /usr/sbin/chroot . /etc/rc.d/rc.halt Deleted lines 194-229:
(:table border=0 width=100% bgcolor=#eeeeff:) (:cell:) # cat /initrd/unslung/rc.reboot #!/bin/sh /bin/umount /initrd /bin/umount /mnt /unslung/mdadm -S /dev/md1 /bin/sleep 2 return 0 (:tableend:) (:table border=0 width=100% bgcolor=#eeeeff:) (:cell:) # cat /initrd/unslung/rc.halt #!/bin/sh /bin/umount /initrd /bin/umount /mnt /unslung/mdadm -S /dev/md1 /bin/sleep 2 # continue with /etc/rc.d/rc.halt return 1 (:tableend:) August 11, 2005, at 10:10 PM
by --
Added lines 1-232:
(:table border=0 width=100% bgcolor=#eeeeff:) (:cell:) # cat /unslung/rc.sysinit #!/bin/sh # The raid devices are /dev/md1 /dev/md2 /dev/md3 # They have already been created in 'linuxrc' # Create and use swap partition /sbin/mkswap /dev/md3 /sbin/swapon /dev/md3 # Mount data and conf partitions /bin/mount -t ext3 /dev/md2 /share/hdd/conf -o rw,noatime /bin/mount -t ext3 /dev/md1 /share/hdd/data -o rw,noatime # Continue with the rest of the /etc/rc.d/rc.sysinit script return 1 (:tableend:) (:table border=0 width=100% bgcolor=#eeeeff:) (:cell:) # cat /unslung/rc.1 #!/bin/sh #/sbin/ifconfig ixp0 hw ether 00:C0:02:01:01:04 #/bin/echo "Starting Set CGI_ds.conf:"; /etc/rc.d/rc.bootbin; check_status # We have commented out the 'bootbin' line above so we must provide replacements # The rc.sysinit diversion has already mounted the RAID arrays # This next line brings the ethernet interface up /sbin/ifup # These three lines are optional cp /opt/etc/passwd /etc/passwd cp /opt/etc/passwd /share/hdd/conf/passwd [ - L /root ] || ln -sf /opt/root /root if ( [ -f /.ext3flash ] ) ; then /bin/echo "Remounting /dev/sda1 as ext3flash:" /bin/mount -o remount,rw,noatime /dev/sda1 /bin/echo "Remounting /dev/sda2 as ext3flash:" /bin/mount -o remount,rw,noatime /dev/sda2 /bin/echo "Removing swap from ext3flash:" /sbin/swapoff /dev/sda3 fi /bin/echo "Restore time and timezone:"; /etc/rc.d/rc.rstimezone; check_status #/bin/echo "Restore usrgrpshares:"; /etc/rc.d/rc.reset_usrgrpshare; check_status #/bin/echo "Generating telnet password:"; /usr/sbin/TelnetPassword; check_status #/bin/echo "Restore time and timezone:"; /etc/rc.d/rc.rstimezone; check_status /bin/echo "Starting WEB Server:"; . /etc/rc.d/rc.thttpd;check_status /bin/echo "Starting samba:"; . /etc/rc.d/rc.samba #/bin/echo "Starting download:"; /usr/sbin/download #/bin/echo "Starting INET Server:"; . /etc/rc.d/rc.xinetd; check_status if ( [ ! -f /.sda1root ] && [ ! -f /.sda2root ] && [ ! -f /.sdb1root ] && [ ! -f /.sdb2root ] ) ; then /bin/echo "Creating ramfs for /tmp:"; mount -t ramfs none /tmp -o maxsize=512 fi /bin/rm -rf /tmp/* /mnt/backup/* /bin/chmod 1777 /tmp #/bin/echo "Starting QuickSet Daemon :"; . /etc/rc.d/rc.quickset /bin/echo "Starting Crond :"; . /etc/rc.d/rc.crond /bin/echo "Starting Rest Task :"; . /etc/rc.d/rc.local /bin/echo "Starting UNSLUNG Packages:"; ( . /etc/rc.d/rc.unslung-start ) /usr/bin/Set_Led ready /usr/bin/Set_Led beep1 #/bin/echo "Checking disk status :"; /usr/sbin/CheckDiskFull 2 >/dev/null # Do not continue with the /etc/rc.d/rc.1 script return 0 (:tableend:) (:table border=0 width=100% bgcolor=#eeeeff:) (:cell:) # cat /unslung/rc.reboot #!/bin/sh cd / /bin/echo "Stopping Unslung packages"; ( . /etc/rc.d/rc.unslung-stop ) /bin/killall -2 upnpd 2>/dev/null /bin/sleep 4 # Switch off ethernet interface /sbin/ifdown ixp0 # Stop Samba /bin/killall nmbd 2>/dev/null /bin/killall smbd 2>/dev/null # Stop webserver /bin/killall -SIGUSR2 thttpd 2>/dev/null /bin/sleep 2 # Unmount all drives /bin/umount /share/flash/conf 2>/dev/null /bin/umount /share/flash/data 2>/dev/null /bin/umount /share/hdd/conf 2>/dev/null /bin/umount /share/hdd/data 2>/dev/null /sbin/swapoff /dev/sda3 2>/dev/null /sbin/swapoff /dev/sdb3 2>/dev/null /sbin/swapoff /dev/md3 2>/dev/null # Stop RAID arrays /opt/sbin/mdadm -S /dev/md3 /opt/sbin/mdadm -S /dev/md2 # No point doing the next line... # resource will be busy but try anyway /opt/sbin/mdadm -S /dev/md1 /bin/sleep 2 # doing reverse of '/etc/rc' script #/bin/mount -o remount,ro /dev/root / /bin/umount /proc/bus/usb /bin/umount /proc cd /initrd /sbin/pivot_root . initrd exec /usr/sbin/chroot . /etc/rc.d/rc.reboot # Should never reach here /bin/echo "should never reach here..." /opt/sbin/mdadm -S /dev/md1 2>/dev/null # Reboot! /sbin/reboot (:tableend:) (:table border=0 width=100% bgcolor=#eeeeff:) (:cell:) # cat /unslung/rc.halt #!/bin/sh cd / /bin/echo "Stopping Unslung packages"; ( . /etc/rc.d/rc.unslung-stop ) /bin/killall -2 upnpd 2>/dev/null /bin/sleep 4 # Switch off ethernet interface /sbin/ifdown ixp0 # Stop Samba /bin/killall nmbd 2>/dev/null /bin/killall smbd 2>/dev/null # Stop webserver /bin/killall -SIGUSR2 thttpd 2>/dev/null /bin/sleep 2 # Unmount all drives /bin/umount /share/flash/conf 2>/dev/null /bin/umount /share/flash/data 2>/dev/null /bin/umount /share/hdd/conf 2>/dev/null /bin/umount /share/hdd/data 2>/dev/null /sbin/swapoff /dev/sda3 2>/dev/null /sbin/swapoff /dev/sdb3 2>/dev/null /sbin/swapoff /dev/md3 2>/dev/null # Stop RAID arrays /opt/sbin/mdadm -S /dev/md3 /opt/sbin/mdadm -S /dev/md2 /opt/sbin/mdadm -S /dev/md1 /bin/sleep 3 # doing reverse of '/etc/rc' script /bin/mount -o remount,ro /dev/root / /bin/umount /proc/bus/usb /bin/umount /proc # Pivot to initrd and run rc.halt there cd /initrd /sbin/pivot_root . initrd exec /usr/sbin/chroot . /etc/rc.d/rc.halt /sbin/halt-test &>/dev/null /bin/sleep 2 /sbin/halt-test &>/dev/null (:tableend:) (:table border=0 width=100% bgcolor=#eeeeff:) (:cell:) # cat /initrd/unslung/rc.reboot #!/bin/sh /bin/umount /initrd /bin/umount /mnt /unslung/mdadm -S /dev/md1 /bin/sleep 2 return 0 (:tableend:) (:table border=0 width=100% bgcolor=#eeeeff:) (:cell:) # cat /initrd/unslung/rc.halt #!/bin/sh /bin/umount /initrd /bin/umount /mnt /unslung/mdadm -S /dev/md1 /bin/sleep 2 # continue with /etc/rc.d/rc.halt return 1 (:tableend:) |