blade- wrote:
Has anyone made a script that will, emerge sync, emerge -UDp world outputs the results to email?
I am not to good at shell scripting, I have been trying to base it off a script I have that updates the root hints and email the results but I am not getting any where. I want it to be a daily cronjob so I dont have to do it manually everyday.



-- [EMAIL PROTECTED] mailing list


It performs sync, does pretend update and logs it, emails the list of updates with date and fetches all updates and logs it. Use it as it is or provide feedback as you like.


----  sync.sh ----
#!/bin/bash

DATE=$(date "+%a %d %b %Y %H:%M")
DIR=/tmp/portage
LOG_UPDATES=$DIR/updates_world.log
LOG_FETCH=$DIR/updates_fetch.log
HOST=$(hostname | awk -F. '{print $1}')
EMAIL="[EMAIL PROTECTED]"

emerge sync
emerge -Duvp world | tee $LOG_UPDATES
NUMBER=$(grep ebuild $LOG_UPDATES | wc -l | awk '{ print $1 }')
SUB1="$HOST - $NUMBER world updates ($DATE)"
echo -e '\nNo. of world updates = '$NUMBER >> $LOG_UPDATES
mail -s "$SUB1" $EMAIL < $LOG_UPDATES
emerge -Duf world | tee $LOG_FETCH
---- END ----


-- [EMAIL PROTECTED] mailing list



Reply via email to