Re: Question about upgrading debian using crontab
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Ok, here come the scripts, attached to this email. ".mod" only
signals, that those are "modified" scripts. It is pretty ugly, cause
it's from scratch.
"dukath-connect" is starting the internet/VPN connection and
"dukath-disconnect" just does the opposite thing.
"admin" is the mail-user on our system. His Mails are availible via
IMAP (dovecot as server). For sending local emails, I installed exim.
As I already mentioned, this script doesn't really do something, it
only runs the upgrade in a simulation mode. I wanted to discuss the
open questions first in this newsgroup (see mail earlier in this
thread with my questions <[🔎] 42189814.6060907@stud.uka.de>), before
letting it really run on my system.
I'd welcome any suggestions or further developement of this script,
please let me know.
- --
[bysf]
simon frettloeh # mailto:simonfr@gmx.net
pgp keyid:0x372A2577 # available on all public key servers
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (MingW32)
iD8DBQFCGKY0eRT02zcqJXcRAjaIAKCh0V1mDxNXOaJ8Snvn80e3Qg64IACg8L2r
mCd0KOhcGzhfN5VkgpTuvEQ=
=g32P
-----END PGP SIGNATURE-----
#!/bin/bash
UPDATEEMAIL=/tmp/updateemail
/root/bin/einUpdateTest > $UPDATEEMAIL-log
if [ $? != 0 ]; then
echo "Subject: FEHLER: automatisches Update fehlgeschlagen!" > $UPDATEEMAIL
echo "Dieses Problem sollte auf jeden Fall behoben werden." >> $UPDATEEMAIL
else
echo "Subject: automatisches Update durchgefuehrt" > $UPDATEEMAIL
fi
echo "==[Mitschnitt des Updateskriptes]========================================" >> $UPDATEEMAIL
cat $UPDATEEMAIL-log >> $UPDATEEMAIL
/usr/sbin/sendmail admin<$UPDATEEMAIL
#!/bin/bash
# Skript baut selbststaendig VPN-Verbindung auf
# und fuehrt dann ein Update des Systems durch
# Autor: simonfr@gmx.net
echo "$0: Autmatisches Update wird gestartet ..."
# Pruefen, ob Netzverbindung aktiv/VPN funktioniert
wget --quiet www.heise.de 2>&1 >/dev/null
if [ $? != 0 ]; then
echo "* Kein Netz/VPN vorhanden. Starte vpnc neu ..."
echo "* Stoppe evtl vorhandenen vpnc."
/usr/local/sbin/dukath-disconnect
echo "* Starte vpnc."
/usr/local/sbin/dukath-connect
fi
# Update Cache
echo "* Starte apt-get update"
apt-get -q update
if [ $? != 0 ]; then
echo "! ACHTUNG: apt-get update hat einen Fehler gemeldet."
exit 1
fi
# Fuehre Upgrade durch
# (tatsaechlich werden erst hier die Pakete aktualisiert)
echo "* Starte apt-get upgrade world"
# "-s" ist nur Simulationsmodus
apt-get -q -y -s upgrade
if [ $? != 0 ]; then
echo "! ACHTUNG: apt-get upgrade hat einen Fehler gemeldet."
exit 1
fi
# Aus Sicherheitsgruenden will ich die VPN-Verbindung
# nicht staendig aktiv halten. Also stoppen ...
echo "* Stoppe aus Sicherheitsgruenden vpnc ..."
/usr/local/sbin/dukath-disconnect
exit 0
Reply to: