Code: Select all
#!/bin/sh
BIGF="-kc-fixed-medium-r-normal--16-160-72-72-c-160-big5-0"
ENGF="8x16"
TERM=xterm
DISPLAY=:0.0
TMPFILE="/tmp/.emergeupdate.flag"
trap "rm -f $TMPFILE" 0 9 15
if [ -e $TMPFILE ]; then
echo "tmpfile exists, quit"
exit 1
fi
sudo emerge sync
sudo emerge -pu --deep world | grep "\[" > $TMPFILE
if [ `wc -l $TMPFILE | awk '{print $1}'` -gt 0 ]; then
/usr/bin/rxvt -fm $BIGF -fn $ENGF -km big5 -fg white -bg black \
-T "Available Update(s)" \
-e tail -f $TMPFILE
fi
echo "done!"
Code: Select all
*/20 * * * * /home/pahud/bin/emergeupdate 2>&1 > /tmp/emergeupdate.cron.logCode: Select all
# Same thing without a password
%wheel ALL=(ALL) NOPASSWD: ALL