1 |
On Wed, 28 Sep 2005 12:12, Pawe³ Madej wrote: |
2 |
> Dunc wrote: |
3 |
> > For something you should only do once a day, 10 minutes isn't that bad |
4 |
> > though. |
5 |
> |
6 |
> I sync not day by day but 2-3 times a week but when I sync I want to run |
7 |
> just after it emerge of updates (I follow new ebuilds on [1] site and |
8 |
> run emerge if sth interesting for me appears there). |
9 |
> |
10 |
> My other question is if there is some script which could follow rrs from |
11 |
> [1] and run emerge sync and emerge -uND world after there is for example |
12 |
> 10 ebuild updated comparing to my system, or other way that it will |
13 |
> email me that there is 10 ebuilds new and i should run sync manually. |
14 |
> |
15 |
> Greets |
16 |
> Pawe³ |
17 |
I second esync. It is a nice script that runs a little faster than 'emerge |
18 |
sync'. I have a little script in my daily cron list that follows... |
19 |
|
20 |
#! /bin/sh |
21 |
# /etc/cron.daily/esync.automated |
22 |
# ============================================================================ |
23 |
# Based on rkhunter script by Aaron Walker <ka0ttic@g.o> |
24 |
# Written by Glenn Enright on 14-Oct-2004 |
25 |
# |
26 |
# Purpose |
27 |
# To provide a facility to regularly update the portage tree via cron so we |
28 |
# don't have to remember to do it manually, and send us a list of updates to |
29 |
# consider. |
30 |
# |
31 |
# Requires |
32 |
# portage to be properly installed. see 'man emerge' for details |
33 |
# esearch: do 'emerge esearch' |
34 |
# |
35 |
# CHANGELOG: |
36 |
# 19-Oct-2004 - updated to use tool esearch. Improved speed and |
37 |
# feedback. |
38 |
# 29-Sep-2005 - Reviewed code and did some tidying up. Changed file |
39 |
# group to wheel to allow easier administration. |
40 |
# |
41 |
|
42 |
# ---------------------------------------------------------------------------- |
43 |
# ENABLEMENT OPTIONS |
44 |
|
45 |
# set to no if you don't want to run this script |
46 |
# |
47 |
ENABLE=yes |
48 |
|
49 |
# set to 'yes' if you wish the output to be mailed to you |
50 |
# |
51 |
SEND_EMAIL=yes |
52 |
|
53 |
# ---------------------------------------------------------------------------- |
54 |
# OPERATIONAL COMMANDS |
55 |
|
56 |
# main command |
57 |
# fixme: is nice needed with 2.6 kernel? |
58 |
CMD="nice esync --nocolor --nospinner" |
59 |
|
60 |
# NOTE: the rest of these options are only relevant |
61 |
# if you set SEND_EMAIL to 'yes' |
62 |
# |
63 |
EMAIL_SUBJECT="${HOSTNAME}: 'esync' output" |
64 |
EMAIL_RECIPIENT=root |
65 |
EMAIL_CMD="| mail -s \"${EMAIL_SUBJECT}\" ${EMAIL_RECIPIENT}" |
66 |
|
67 |
# ============================================================================ |
68 |
|
69 |
if [ "${ENABLE}" = "yes" ]; then |
70 |
|
71 |
if [ -x /usr/bin/emerge ]; then |
72 |
#------------------------------------------------------- |
73 |
# test to see if we want to send success/failure email |
74 |
# |
75 |
if [ "${SEND_EMAIL}" = "yes" ]; then |
76 |
CMD="${CMD} ${EMAIL_CMD}" |
77 |
else |
78 |
CMD="${CMD} &>/dev/null" |
79 |
fi |
80 |
# ------------------------------------------------------ |
81 |
|
82 |
|
83 |
# ------------------------------------------------------ |
84 |
# check to see if emerge is already running so |
85 |
# we dont interupt it. fail gracefully if it is |
86 |
# |
87 |
if [ ! "ps -ax | grep -c emerge" ]; then |
88 |
# NB: the following text is formated from the margin. |
89 |
MAIL_WARN_MESSAGE="echo -e ' ** WARNING ** : The program 'emerge' is |
90 |
currently running. Please wait for the next scheduled update or run esync |
91 |
manually.'" |
92 |
eval exec "${MAIL_WARN_MESSAGE} ${EMAIL_CMD}" |
93 |
else |
94 |
# actually do the thing |
95 |
eval exec "${CMD}" |
96 |
fi |
97 |
# ----------------------------------------------------- |
98 |
|
99 |
fi |
100 |
fi |
101 |
# EOF |
102 |
|
103 |
-- |
104 |
|
105 |
The programmers of old were mysterious and profound. We cannot fathom |
106 |
their thoughts, so all we do is describe their appearance. |
107 |
Aware, like a fox crossing the water. Alert, like a general on the |
108 |
battlefield. Kind, like a hostess greeting her guests. Simple, like uncarved |
109 |
blocks of wood. Opaque, like black pools in darkened caves. |
110 |
Who can tell the secrets of their hearts and minds? |
111 |
The answer exists only in the Tao. |
112 |
-- Geoffrey James, "The Tao of Programming" |
113 |
|
114 |
-- |
115 |
gentoo-user@g.o mailing list |