#!/bin/sh
TMPLOG=/tmp/pttbackup
MAIL_TO=root
CD_DEV=/dev/scd0

/sbin/mke2fs -b 2048 $CD_DEV
/usr/bin/dpkg --get-selections > /home/ptt_deb_selections
/bin/tar cvfz /home/.etc.tar.gz /etc > $TMPLOG 2&>1
/usr/bin/growisofs -allow-lowercase -relaxed-filenames -allow-multidot -allow-leading-dots -joliet -rational-rock -disable-deep-relocation -full-iso9660-filenames -verbose -Z $CD_DEV $@ > $TMPLOG 2&>1 && echo "Salvataggio notturno concluso positivamente." >> $TMPLOG && /usr/bin/tail -n 20 $TMPLOG | /usr/sbin/sendmail $MAIL_TO && /usr/bin/eject /dev/scd0  && exit

/bin/echo "Salvataggio notturno del server *NON* concluso con esito positivo. Verificare!!!" | /usr/sbin/sendmail $MAIL_TO 
exit

