Dont you just hate it when ` apt-get upgrade ` changes your /etc/rc*.d's and starts daemons that you dont need running?
Here is a simple script to help by simply making a backup of your /etc/rc*.d directories and restoring them once the upgrade is finished.
system-upgrade.sh
Code:#!/bin/bash if [ $UID = "0" ]; then clear STATUS=0 echo "Please Wait:" echo -n "Updating Sources ...." apt-get -q update >/dev/null 2>&1 echo ".Done." echo -n "Backing up /etc/rc*.d ...." TEMP=/tmp/system-upgrade-$RANDOM mkdir $TEMP cp -a /etc/rc*.d $TEMP/. >/dev/null echo ".Done." echo "" echo "Performing Upgrade:" # Set STATUS= according to apt-gets exit status. # In place for later expansions apt-get -q upgrade && STATUS=0 || STATUS=1 # For now if STATUS=1 (Error) just exit without cleanup echo "" echo -n "Restoring /etc/rc*.d ..." rm -rfd /etc/rc*.d >/dev/null cp -a $TEMP/* /etc/. echo ".Done." [ $STATUS = 1 ] && exit 1 echo "" echo -n "Cleaning up ...." apt-get clean rm -rfd $TEMP echo ".Done." else echo "This script must be run as root!" fi
Here is another small script to simply update your sources and check if there are packages that can be upgraded.
checkup.sh
This script can be used in a cron if you null the output ( >/dev/null ) then evaluate /etc/apt/checkupgrades.status with something like:Code:#!/bin/bash if [ $UID = 0 ]; then echo "Checking for available upgrades...." apt-get update >/dev/null apt-get -s upgrade | grep Inst >/tmp/checkupgrades.out if [ -s /tmp/checkupgrades.out ]; then echo "" echo "... There are new updates for your system!" echo 1 >/etc/apt/checkupgrades.status rm -f /tmp/checkupgrades.out else echo "" echo "... There are no new updates for your system!" echo 0 >/etc/apt/checkupgrades.status rm -f /tmp/checkupgrades.out fi else echo "This script must be run as root!" fi
Code:CHECKUP_STATUS=$(cat /etc/apt/checkupgrades.status) if [ $CHECKUP_STATUS = 1 ]; then # There are upgrades else # No upgrades fi
Hoefully someone will find some of this usefull
Take Care,
-Justin
One Mynds Eye

SFP TO RJ45 TRANSCEIVER SFP MODULE COPPER SFP OPTICAL PORT TO RJ45 ETHERNET PORT
$7.99
Cisco Acacia DP04QSDD-E25-840 400G QSFP-DD Coherent DCO Transceiver Module
$699.99
NEW Sealed Cisco SFP-10G-LR 10GBASE-LR SFP+ 1310nm 10km *US Shipping*
$24.00
CISCO CVR-X2-SFP10G X2 to SFP+ 10GB 74-6321-03 Converter Module *Lot of 14”
$115.19
Genuine Cisco SFP-10G-SR 0-2415-03 10 Gigabit Transceiver
$5.40
Intel X520-DA2 10Gb 10Gbe 10 Gigabit Network Adapter NIC Dual Port E10G42BTDA
$28.94
HP 560SFP+ 10GB 2-port PCIe NIC Ethernet ADAPTER 669279-001 w/ (2) 10GB SFP+
$16.99
Lenovo 00YK615 Intel X710-DA2 10GbE 2-port SFP+ PCI-E FC Network Adapter NIC
$27.99
Arista SFP-10G-SR 10GBASE-SR XVR-10001-20 850nm SFP+ Optical Transceiver
$30.00
Dell 10 Gigabit SFP+ SR Transceiver 0XYD50 NEW SEALED
$24.99