Changeset 181
- Timestamp:
- 09/16/06 15:01:57 (2 years ago)
- Files:
-
- debian/branches/upstream/current/Changelog (modified) (1 diff)
- debian/branches/upstream/current/FAQ (added)
- debian/branches/upstream/current/INSTALL (modified) (1 diff)
- debian/branches/upstream/current/Makefile (added)
- debian/branches/upstream/current/NEWS (added)
- debian/branches/upstream/current/README (modified) (6 diffs)
- debian/branches/upstream/current/metche (modified) (20 diffs, 1 prop)
- debian/branches/upstream/current/metche-manpage.sgml (added)
- debian/branches/upstream/current/metche.8 (modified) (1 diff)
- debian/branches/upstream/current/metche.conf.default (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
debian/branches/upstream/current/Changelog
r115 r181 1 02-17-2006 - metche 1.0 1 1.1 (2006 09 16) 2 3 * ververs: added Linux VServers support. 4 * EXCLUDES: added a few everchanging Postfix files, and AlternC's 5 local.sh 6 * documentation: clear up the way backups are made (Closes: #365694) 7 8 1.0 (2006 02 17) 2 9 3 10 * Initial release. 4 debian/branches/upstream/current/INSTALL
r115 r181 3 3 `------------------------------------------------------------------------------- 4 4 5 1. Have a look tothe REQUIREMENTS section in the README file.5 1. Have a look at the REQUIREMENTS section in the README file. 6 6 2. Copy the metche executable to /usr/local/sbin/ 7 3. As root, mkdir /var/lib/metche 8 4. Copy the manpage (metche.8) to /usr/local/man/man8/ 9 5. Read the README file and the manpage 7 3. Copy the manpage (metche.8) to /usr/local/man/man8/ 8 4. Read the README file, the FAQ and the manpage 10 9 debian/branches/upstream/current/README
r115 r181 1 1 metche - reducing root bus factor 2 homepage : https://poivron.org/dev/metche/ 2 homepage: https://poivron.org/dev/metche/ 3 dev team: metche AT lists DOT riseup DOT net 3 4 4 5 ,------------------------------------------------------------------------------- … … 23 24 `------------------------------------------------------------------------------- 24 25 25 metche is a tool meant to facilitate collective sysadmin ; basically, it26 metche is a tool meant to ease collective system administration. It does 26 27 periodically : 27 - save s the "system state" to $BACKUP_DIR (default /var/lib/metche), i.e. :28 - save the "system state" of 28 29 . $WATCHED_DIR (default: /etc) 29 30 . $CHANGELOG_FILE (default /root/Changelog) 30 31 or $CHANGELOG_DIR/*/Changelog (default: /root/changelogs/*/Changelog) 31 32 . Debian packages states and versions (using apt-show-versions) 32 - sends you, in a nicely formated email, the last changes to the "system 33 state"; see https://poivron.org/dev/metche/ for an example. 33 to $BACKUP_DIR (default: /var/lib/metche). 34 - send a nicely formatted email to a defined email address, listing the last 35 changes that have been made to the system. 36 See https://poivron.org/dev/metche/ for an example. 34 37 35 38 ,------------------------------------------------------------------------------- … … 37 40 `------------------------------------------------------------------------------- 38 41 39 When installed and configured, metche is run by a cron job, and you just have to40 read the report emails. Of course , it's not useful at all if you don't:41 - set $EMAIL_ADDRESS config variable to your sysadmin collective mailing-list42 address;42 When installed and configured, metche is run by a cron job. You just have to 43 read the report emails. Of course it's not useful at all if you don't: 44 - set the $EMAIL_ADDRESS config variable to your sysadmins' collective 45 mailing-list or email address; 43 46 - use the Changelog files in a rigorous way. 44 47 45 Note: it is dangerous to use metche without beforereading the SECURITY section46 of the manpage .48 Note: It is dangerous to use metche without reading the SECURITY section 49 of the manpage before. 47 50 48 For a deeper explanation of the way metche works, read the metche(8) manpage. 51 For further explanation of the way metche works, read the metche(8) manpage and 52 the FAQ file. 49 53 50 54 ,------------------------------------------------------------------------------- … … 52 56 `------------------------------------------------------------------------------- 53 57 54 * Debian GNU/Linux and apt-show-versions (if Debian package smonitoring is55 enabled)58 * Debian GNU/Linux and apt-show-versions (if Debian package monitoring is 59 enabled) 56 60 * mutt 57 61 * bzip2 58 * If you want metche to encrypt the email it sends you: gnupg59 * If you want metche to monitor your vservers as well : util-vserver tools62 * If you want metche to encrypt the email it sends: gnupg 63 * If you want metche to monitor your vservers as well: util-vserver tools 60 64 * If you want metche to monitor one manually written Changelog file, 61 65 it must be located at $CHANGELOG_FILE. 62 66 _or_ If you want metche to monitor multiple manually written Changelog 63 files, they must be located in $CHANGELOG_DIR/*/Changelog ;64 for example , you can have:67 files, they must be located in $CHANGELOG_DIR/*/Changelog; 68 for example this way: 65 69 /root/ 66 70 changelogs/ … … 73 77 `------------------------------------------------------------------------------- 74 78 75 See the included INSTALL file.79 Please see the included INSTALL file. 76 80 77 81 ,------------------------------------------------------------------------------- … … 82 86 your needs. 83 87 2. Read the next sections of this document and the metche(8) manpage. 84 3. Add to /etc/cron.d/metche something like :88 3. Add to /etc/cron.d/metche something like: 85 89 0-59/5 * * * * root test -x /usr/local/sbin/metche && \ 86 90 /usr/local/sbin/metche cron 91 See the cron (8) manpage for further explanations on how to create a cron 92 job. 87 93 88 94 ,------------------------------------------------------------------------------- 89 | SECURITY : BIG FAT WARNING 95 | VSERVERS SUPPORT 96 `------------------------------------------------------------------------------- 97 98 Just add one (or more) VServer name to the VSNAMES configuration variable, and 99 metche will monitor it in addition to the host system: 100 - the WATCHED_DIR, CHANGELOG_DIR and CHANGELOG_FILE paths are also used, 101 relatively to your VServer's root directory; 102 - the "system state" backups will be saved in sub-directory in BACKUP_DIR's, 103 called the same as the VServer; 104 - EMAIL_ADDRESS is not used for the VServers: the report messages will be 105 sent to the your VServer's root email address; if you're using 106 ENCRYPT_EMAIL to encrypt the report messages, make sure their public key is 107 in the host system root's keyring, trusted enough to be used blindly by 108 metche; 109 - all other configuration variables are used as it. 110 111 Most of metche commands (namely: list, report and stabilize) support a 112 '-h <VSERVER>' option: 113 - if -h is specified, metche only operates on the VServer provided as an 114 argument; 115 - else, metche only operates on the host system. 116 117 Troubleshooting: in case you have a not-purely-Debianish VServer setup, you may 118 have to customize some of the VServers-related configuration variables. See the 119 comments in metche.conf for more details. 120 121 ,------------------------------------------------------------------------------- 122 | SECURITY WARNING 90 123 `------------------------------------------------------------------------------- 91 124 92 125 Read the SECURITY section of metche(8). Really. 93 126 94 ,-------------------------------------------------------------------------------95 | FAQ96 `-------------------------------------------------------------------------------97 98 1. How are the monitored Changelog files ($CHANGELOG_FILE or99 $CHANGELOG_DIR/*/Changelog) generated ?100 101 With Emacs or Vim. Ah ah. They are written by *you* ! They are an important102 part of the collective sysadmin process metche is supposed to facilitate.103 104 2. Hey, how is metche working, and what are the underlying concepts I have to105 know ?106 107 When called with the "cron" command line switch, metche looks if the "system108 state" has changed in the last $TESTING_TIME minutes. If it is the case, a109 "unstable" state is saved. Otherwise, a "testing state" is saved, and a110 report is emailed to you.111 112 A similar mechanism to automatically turn a "testing" state into a "stable"113 one ; see metche(8) for explainations.114 115 3. How do I see the saved states list ?116 117 Run "metche list".118 119 4. I've broken my system, how can I see a report against a previous, known120 working, system state ?121 122 Run "metche report [{stable,testing,unstable}-YYYYMMDDHHMM]".123 If no saved state is specified, the latest "testing state" is used as124 reference.125 126 5. How do I create a "stable state" by hand ?127 128 Run "metche stabilize [testing-YYYYMMDDHHMM]".129 This turns the given testing state, if specified, or the latest one,130 otherwise, into a "stable state".debian/branches/upstream/current/metche
- Property svn:executable set to *
r115 r181 1 1 #! /bin/bash 2 2 # -*- mode: sh; sh-basic-offset: 4; indent-tabs-mode: nil; -*- 3 # 4 # SVN version: $Id: metche 176 2006-09-15 15:31:11Z intrigeri $ 5 # $URL: http://poivron.org/dev/svn/metche/upstream/tags/metche-1.1/metche $ 3 6 # 4 7 # metche: reducing root bus factor … … 28 31 29 32 display_usage() { 30 ( echo "Usage: `basename $0` list" 31 echo " `basename $0` report" \ 33 ( echo "Usage:" 34 echo " `basename $0` [-h VSERVER] list" 35 echo " `basename $0` [-h VSERVER] report" \ 32 36 "[{stable|testing|unstable}-YYYYMMDDHHMM]" 37 echo " `basename $0` [-h VSERVER] stabilize [testing-YYYYMMDDHHMM]" 38 echo "" 39 echo " With -h, the VServer VSERVER is operated on instead of the host system." 40 echo "" 41 echo "Non-interactive usage:" 33 42 echo " `basename $0` cron" 34 echo " `basename $0` stabilize [testing-YYYYMMDDHHMM]"35 43 echo "" 36 44 ) >&2 … … 38 46 39 47 fatal() { 40 echo -e " $@" >&248 echo -e "Fatal: $@" >&2 41 49 exit 2 50 } 51 52 warning() { 53 echo -e "Warning: $@" >&2 54 } 55 56 debug() { 57 [ "$DEBUG" != yes ] || echo -e "Debug: $@" >&2 42 58 } 43 59 … … 45 61 local executable="$1" 46 62 local software="$2" 47 local option="$3" 48 49 fatal "$executable not found. Please install $software or turn $option off." 50 } 51 52 debug() { 53 [ "$DEBUG" != yes ] || echo -e "debug: $@" >&2 63 local dependant_option="$3" 64 local solution_option="$4" 65 66 if [ -z "$solution_option" ]; then 67 fatal "$executable not found on `current_system`." \ 68 "Please install $software or turn $dependant_option off." 69 else 70 fatal "$executable not found on `current_system`." \ 71 "Please install $software, customize $solution_option" \ 72 "or turn $dependant_option off." 73 fi 54 74 } 55 75 56 76 email() { 57 debug " email $@"58 local subject=" $_MAIL_SUBJECT : $1"77 debug "* email $@ to $EMAIL_ADDRESS" 78 local subject="`current_system` - $_MAIL_SUBJECT : $1" 59 79 if [ $ENCRYPT_EMAIL = "yes" ]; then 60 80 LC_ALL="$LOCALE" gpg --batch --armor --encrypt \ … … 64 84 LC_ALL="$LOCALE" mutt -s "$subject" "$EMAIL_ADDRESS" 65 85 fi 86 } 87 88 current_system() { 89 $VSERVER_EXEC_PREFIX hostname -f 66 90 } 67 91 … … 83 107 EMAIL_ADDRESS="root@`hostname -f`" 84 108 ENCRYPT_EMAIL="no" 85 EXCLUDES="*.swp #* *~ *.key ifstate adjtime ld.so.cache shadow* \ 86 blkid.tab* aumixrc net.enable mtab \ 87 vdirbase run.rev vdir run.rev" 109 EXCLUDES="*.swp #* *~ *.gpg *.key ifstate adjtime ld.so.cache shadow* \ 110 .gnupg blkid.tab* aumixrc net.enable mtab backup.d \ 111 vdirbase run.rev vdir run.rev \ 112 prng_exch smtp_scache.pag smtpd_scache.pag \ 113 smtp_scache.dir smtpd_scache.dir local.sh" 88 114 LOCALE="C" 89 115 90 _MAIL_SUBJECT="`hostname -f` - changes report" 116 VSNAMES="" 117 VSERVERINFO=/usr/sbin/vserver-info 118 VSERVER=/usr/sbin/vserver 119 120 _MAIL_SUBJECT="changes report" 91 121 _NO_DEBIAN_PACKAGES_CHANGE="No change in Debian packages state." 92 122 _NO_CHANGE="No change." … … 127 157 128 158 if [ "$1" = "-h" ]; then 129 if [ -f /etc/metche/$2.conf ]; then 130 . /etc/metche/$2.conf 131 CMD="$3" 132 MILESTONE="$4" 133 else 134 display_usage 135 fatal "Config file /etc/metche/$2.conf does not exist." 136 fi 137 elif [ -f /etc/metche.conf ]; then 138 . /etc/metche.conf 159 VSNAME="$2" 160 CMD="$3" 161 MILESTONE="$4" 162 else 139 163 CMD="$1" 140 164 MILESTONE="$2" 165 fi 166 167 if [ -f /etc/metche.conf ]; then 168 . /etc/metche.conf 141 169 else 142 170 display_usage … … 151 179 umask 077 152 180 153 test -d "$WATCHED_DIR" || fatal "WATCHED_DIR ($WATCHED_DIR) does not exist." 154 test -d "$BACKUP_DIR" || fatal "BACKUP_DIR ($BACKUP_DIR) does not exist." 155 test -z "$TAR_OPTS" || fatal "TAR_OPTS is deprecated, use EXCLUDES instead." 156 157 if [ "$DO_PACKAGES" = "yes" ]; then 158 which apt-show-versions > /dev/null || 159 executable_not_found "apt-show-versions" "it" "DO_PACKAGES" 181 # Manage deprecated configuration files and options 182 test ! -d /etc/metche || fatal "An old configuration directory (/etc/metche/)" \ 183 "was found, please upgrade your configuration." 184 test -z "$TAR_OPTS" || fatal "TAR_OPTS is deprecated, use EXCLUDES instead." 185 186 # Backup various configuration values: these non-underscored variable 187 # names will be re-initialized in context_config() and re-used everywhere. 188 _WATCHED_DIR="$WATCHED_DIR" 189 _BACKUP_DIR="$BACKUP_DIR" 190 _CHANGELOG_DIR="$CHANGELOG_DIR" 191 _CHANGELOG_FILE="$CHANGELOG_FILE" 192 _DO_PACKAGES="$DO_PACKAGES" 193 _EMAIL_ADDRESS="$EMAIL_ADDRESS" 194 195 if [ -n "$VSNAMES" ]; then 196 # check VSERVERINFO and VSERVER availability 197 test -x "$VSERVERINFO" || \ 198 executable_not_found "vserver-info" "util-vserver" "VSNAMES" "VSERVERINFO" 199 test -x "$VSERVER" || \ 200 executable_not_found "vserver" "util-vserver" "VSNAMES" "VSERVER" 201 # check VROOTDIR availability 202 test -n "$VROOTDIR" || \ 203 VROOTDIR="`$VSERVERINFO info SYSINFO \ 204 | grep '^ *vserver-Rootdir' | awk '{print $2}'`" 205 test -n "$VROOTDIR" || \ 206 fatal "VSNAMES is not empty, but VROOTDIR could not be guessed." \ 207 "Please set VROOTDIR in /etc/metche.conf." 208 test -d "$VROOTDIR" || \ 209 fatal "VSNAMES is not empty, but VROOTDIR ($VROOTDIR) does not exist." \ 210 "Please set VROOTDIR in /etc/metche.conf." 211 # expand VSNAMES if it is set to "all" 212 if [ "$VSNAMES" = all ]; then 213 VSNAMES=`ls $VROOTDIR | grep -E -v "lost\+found|ARCHIVES" | tr "\n" " "` 214 if [ -z "$VSNAMES" ]; then 215 warning "VSNAMES is set to \"all\", but no VServer could be found" \ 216 "in VROOTDIR ($VROOTDIR)." 217 fi 218 fi 160 219 fi 161 220 162 221 if [ "$ENCRYPT_EMAIL" = "yes" ]; then 163 222 which gpg > /dev/null || 164 executable_not_found "gpg" "GnuPG" "ENCRPYT_EMAIL" 165 gpg --batch --list-public-keys $EMAIL_ADDRESS >/dev/null 2>&1 || 166 fatal "GnuPG public key for $EMAIL_ADDRESS not found." 223 executable_not_found "gpg" "GnuPG" "ENCRYPT_EMAIL" 167 224 fi 168 225 169 226 DATE=`date "+%Y%m%d%H%M"` 170 WATCHED_PARENT=`dirname $WATCHED_DIR`171 if [ "$WATCHED_PARENT" != '/' ]; then172 WATCHED_PARENT="$WATCHED_PARENT/"173 fi174 227 175 228 # How to use $TAR_OPTS: … … 198 251 set +o noglob 199 252 200 ###201 ### Modules enabling/disabling202 ###203 204 DO_CHANGELOGS="no"205 if [ "$CHANGELOG_DIR" ]; then206 if [ -d "$CHANGELOG_DIR" ]; then207 DO_CHANGELOGS="dir"208 fi209 elif [ -f "$CHANGELOG_FILE" ]; then210 DO_CHANGELOGS="file"211 fi212 213 # Debian packages214 # Enabled/disabled by $DO_PACKAGES, initialized to "yes", can be215 # overriden by the sourced conf file.216 217 253 218 254 ### 219 255 ### A few functions to do the real work 220 256 ### 257 258 # Check and mangle the context-dependant configuration variables, 259 # i.e. the parameters specific to the host system or to a given VServer. 260 # If $1 is empty, operate on the host system. 261 # Else, operate on a VServer and return with exit-code: 262 # - 2 if $1 is not an existing VServer 263 # - 3 if $1 is not a VServer listed in VSNAMES 264 # - 4 if $1 is not a running VServer 265 # Anyway, return with exit-code: 266 # - 5 if the GnuPG public key can not be found 267 context_config() { 268 local vsname="$1" 269 local res 270 debug "-------- Operating on" \ 271 "`if [ -z $vsname ]; then echo 'the host system'; else echo VServer $vsname; fi`" 272 debug "* context_config" 273 274 # 275 # Variables & VServer 276 # 277 278 if [ -z "$vsname" ]; then 279 WATCHED_DIR="$_WATCHED_DIR" 280 BACKUP_DIR="$_BACKUP_DIR" 281 VSERVER_EXEC_PREFIX="" 282 EMAIL_ADDRESS="$_EMAIL_ADDRESS" 283 else 284 WATCHED_DIR="$VROOTDIR/$vsname/$_WATCHED_DIR" 285 BACKUP_DIR="$_BACKUP_DIR/$vsname" 286 VSERVER_EXEC_PREFIX="$VSERVER $vsname exec" 287 EMAIL_ADDRESS="root@`current_system`" 288 # does the current VServer exist ? 289 if [ ! -d "$VROOTDIR/$vsname" ]; then 290 warning " VServer $vsname does not exist (error 2)." 291 return 2 292 fi 293 # is the current VServer listed in VSNAMES ? 294 local found="no"; 295 for i in $VSNAMES; do 296 if [ "$vsname" = "$i" ]; then 297 found=yes 298 break 299 fi 300 done 301 if [ $found = no ]; then 302 warning " VServer $vsname is not listed in VSNAMES (error 3)." 303 return 3 304 fi 305 # is the current VServer running ? 306 res="" 307 $VSERVERINFO -q "$vsname" RUNNING || res=failed 308 if [ "$res" = failed ]; then 309 warning " VServer $vsname is not running (error 4)." 310 return 4 311 fi 312 fi 313 314 # E-mail encryption 315 if [ $ENCRYPT_EMAIL = "yes" ]; then 316 gpg --batch --list-public-keys $EMAIL_ADDRESS >/dev/null 2>&1 317 res=$? 318 if [ $res -ne 0 ]; then 319 warning " GnuPG public key for $EMAIL_ADDRESS not found." 320 return 5 321 fi 322 fi 323 324 # 325 # Files and directories 326 # 327 328 # Check the existence of WATCHED_DIR 329 test -d "$WATCHED_DIR" || \ 330 fatal "$WATCHED_DIR directory (built from WATCHED_DIR) does not exist." 331 332 # Initialize WATCHED_PARENT 333 WATCHED_PARENT=`dirname $WATCHED_DIR` 334 if [ "$WATCHED_PARENT" != '/' ]; then 335 WATCHED_PARENT="$WATCHED_PARENT/" 336 fi 337 338 # Check the existence of the resulting BACKUP_DIR, creating it if needed. 339 if [ ! -d "$BACKUP_DIR" ]; then 340 debug " Creating $BACKUP_DIR directory for `current_system`." 341 if mkdir -p "$BACKUP_DIR"; then 342 debug " Successfully created $BACKUP_DIR directory." 343 else 344 fatal " Failed to create $BACKUP_DIR directory." 345 fi 346 fi 347 348 # 349 # Modules enabling/disabling 350 # 351 352 # DO_CHANGELOGS 353 DO_CHANGELOGS="no" 354 if [ -n "$_CHANGELOG_DIR" ]; then 355 if [ -z "$vsname" ]; then 356 CHANGELOG_DIR="$_CHANGELOG_DIR" 357 else 358 CHANGELOG_DIR="$VROOTDIR/$vsname$_CHANGELOG_DIR" 359 fi 360 if [ -d "$CHANGELOG_DIR" ]; then 361 DO_CHANGELOGS="dir" 362 else 363 warning " The directory $CHANGELOG_DIR (built from CHANGELOG_DIR)" \ 364 " does not exist. Changelogs file monitoring thereferore" \ 365 " cannot be performed this time for `current_system`." 366 fi 367 elif [ -n "$CHANGELOG_FILE" ]; then 368 if [ -z "$vsname" ]; then 369 CHANGELOG_FILE="$_CHANGELOG_FILE" 370 else 371 CHANGELOG_FILE="$VROOTDIR/$vsname$_CHANGELOG_FILE" 372 fi 373 if [ -f "$CHANGELOG_FILE" ]; then 374 DO_CHANGELOGS="file" 375 else 376 warning " The file $CHANGELOG_FILE (built from CHANGELOG_FILE)" 377 warning " does not exist. Changelog file monitoring thereferore" 378 warning " cannot be performed this time for `current_system`." 379 fi 380 fi 381 382 # DO_PACKAGES 383 DO_PACKAGES="$_DO_PACKAGES" 384 if [ "$DO_PACKAGES" = "yes" ]; then 385 $VSERVER_EXEC_PREFIX which apt-show-versions > /dev/null 386 res=$? 387 if [ $res -ne 0 ]; then 388 warning " apt-show-versions not found on `current_system`." 389 warning " Please install it or turn DO_PACKAGES off." 390 warning " DO_PACKAGES therefore cannot be performed this time" 391 warning " for `current_system`." 392 DO_PACKAGES=no 393 fi 394 fi 395 396 # 397 # Final steps to get a coherent initial status 398 # 399 400 # Make sure we've got at least one testing and one stable 401 milestone_exists testing-latest || save_state "testing" 402 milestone_exists stable-latest || stabilize_state "testing-latest" 403 } 221 404 222 405 # Returns 0 if, and only if, specified milestone exists. … … 277 460 # This will save an archive of the watched directory with the given prefix 278 461 save_files() { 279 debug " - save_files $@"462 debug " - save_files $@" 280 463 set -o noglob 281 464 tar jcf "$BACKUP_DIR/$1-$DATE".tar.bz2 \ … … 287 470 # This will save packages list with the given prefix 288 471 save_packages() { 289 debug " - save_packages $@"290 apt-show-versions -i291 apt-show-versions |472 debug " - save_packages $@" 473 $VSERVER_EXEC_PREFIX apt-show-versions -i 474 $VSERVER_EXEC_PREFIX apt-show-versions | 292 475 sort > "$BACKUP_DIR/$1-$DATE".packages 293 476 ln -sf "$1-$DATE".packages "$BACKUP_DIR/$1"-latest.packages … … 296 479 # This will save Changelogs with the given prefix 297 480 save_changelogs() { 298 debug " - save_changelogs $@"481 debug " - save_changelogs $@" 299 482 local changelog domain file 300 483 … … 315 498 # Save whatever reflect the current state with the given prefix 316 499 save_state() { 317 debug " save_state $@"500 debug "* save_state $@" 318 501 save_files "$1" 319 502 [ $DO_PACKAGES = "no" ] || save_packages "$1" … … 323 506 # Report changes against given version to standard output 324 507 report_changes() { 325 debug " report_changes $@"508 debug "* report_changes $@" 326 509 local tmp tmpdir changelog domain diff tar_diff diff_diff 327 510 local files old new tmp_packages file … … 398 581 399 582 tmp_packages=`mktemp -q` 400 apt-show-versions -i401 apt-show-versions | sort > "$tmp_packages"402 if diff -wEbB "$BACKUP_DIR/$1".packages "$tmp_packages"; then583 $VSERVER_EXEC_PREFIX apt-show-versions -i 584 $VSERVER_EXEC_PREFIX apt-show-versions | sort > "$tmp_packages" 585 if diff -wEbBN "$BACKUP_DIR/$1".packages "$tmp_packages"; then 403 586 echo "$_NO_DEBIAN_PACKAGES_CHANGE" 404 587 fi | grep -v '^[0-9-]' >> "$tmp" … … 430 613 # NB: argument validity is supposed to have been already checked. 431 614 stabilize_state() { 432 debug " stabilize_state $@"615 debug "* stabilize_state $@" 433 616 local testing stable file dst 434 617 … … 507 690 ### 508 691 509 # make sure we've got at least one testing and one stable510 milestone_exists testing-latest || save_state "testing"511 milestone_exists stable-latest || stabilize_state "testing-latest"512 513 692 case "$CMD" in 514 693 515 694 report) 695 context_config "$VSNAME" || fatal "Aborting (error $?)." 516 696 DO_DETAILS="yes" 517 697 if [ -z "$MILESTONE" ]; then … … 526 706 527 707 list) 708 context_config "$VSNAME" || fatal "Aborting (error $?)." 528 709 for file in "$BACKUP_DIR"/*.tar.bz2; do 529 710 echo `basename ${file%%.tar.bz2}` … … 533 714 cron) 534 715 STABLE_TIME_MIN=`expr 24 '*' 60 '*' "$STABLE_TIME"` 535 536 ### Algorithm 537 # 538 # if (no change happened for TESTING_TIME) then 539 # if (something has changed since the last testing) then 540 # send a report against last testing 541 # save a new testing state 542 # delete all saved unstable states 543 # elif (no change happened for STABLE_TIME) then 544 # if (something has changed since the last stable) then 545 # save a new stable state and notify EMAIL_ADDRESS 546 # delete all saved testing states older than STABLE_TIME 547 # fi 548 # fi 549 # elif (last unstable exists) then 550 # if (something has changed since the last unstable) then 551 # save a new unstable state 552 # fi 553 # else 554 # save a new unstable state 555 # fi 556 if no_change_since "$TESTING_TIME"; then 557 debug "no change since TESTING_TIME" 558 if changed_from "$BACKUP_DIR"/testing-latest.tar.bz2; then 559 debug "changed from testing-latest" 560 report_changes "testing-latest" | email "testing-$DATE" 561 save_state "testing" 562 debug "removing all saved unstable states." 563 find "$BACKUP_DIR" -name 'unstable-*' -exec rm "{}" \; 564 elif no_change_since "$STABLE_TIME_MIN"; then 565 if changed_from "$BACKUP_DIR"/stable-latest.tar.bz2; then 566 save_state "stable" 567 echo "metche saved a new stable state : stable-${DATE}." | 716 if [ -n "$VSNAME" ]; then 717 display_usage 718 fatal "-h option not available for 'metche cron'" 719 fi 720 721 for i in "" $VSNAMES; do 722 res=0 723 context_config "$i" || res=$? 724 if [ $res -ne 0 ]; then 725 warning "-------- Ignoring" \ 726 "`if [ -z $i ]; then \ 727 echo 'the host system'; \ 728 else \ 729 echo VServer $i; fi` (error $res)" 730 continue 731 fi 732 733 ### Algorithm 734 # 735 # if (no change happened for TESTING_TIME) then 736 # if (something has changed since the last testing) then 737 # send a report against last testing 738 # save a new testing state 739 # delete all saved unstable states 740 # elif (no change happened for STABLE_TIME) then 741 # if (something has changed since the last stable) then 742 # save a new stable state and notify EMAIL_ADDRESS 743 # delete all saved testing states older than STABLE_TIME 744 # fi 745 # fi 746 # elif (last unstable exists) then 747 # if (something has changed since the last unstable) then 748 # save a new unstable state 749 # fi 750 # else 751 # save a new unstable state 752 # fi 753 754 debug "* main algorithm" 755 756 if no_change_since "$TESTING_TIME"; then 757 debug " no change since TESTING_TIME" 758 if changed_from "$BACKUP_DIR"/testing-latest.tar.bz2; then 759 debug " changed from testing-latest" 760 report_changes "testing-latest" | email "testing-$DATE" 761 save_state "testing" 762 debug " removing all saved unstable states." 763 find "$BACKUP_DIR" -name 'unstable-*' -exec rm "{}" \; 764 elif no_change_since "$STABLE_TIME_MIN"; then 765 if changed_from "$BACKUP_DIR"/stable-latest.tar.bz2; then 766 save_state "stable" 767 echo "metche saved a new stable state: stable-${DATE}." | 568 768 email "stable-$DATE" 569 debug "removing all saved testing states older " \ 570 "than STABLE_TIME ($STABLE_TIME)." 571 find "$BACKUP_DIR" -name 'testing-*' \ 572 -ctime +"$STABLE_TIME" -exec rm "{}" \; 769 debug " removing all saved testing states older" \ 770 "than STABLE_TIME ($STABLE_TIME)." 771 find "$BACKUP_DIR" -name 'testing-*' \ 772 -ctime +"$STABLE_TIME" -exec rm "{}" \; 773 fi 573 774 fi 574 fi 575 elif milestone_exists unstable-latest; then 576 if changed_from "$BACKUP_DIR"/unstable-latest.tar.bz2; then 577 debug "changed from unstable-latest" 775 elif milestone_exists unstable-latest; then 776 if changed_from "$BACKUP_DIR"/unstable-latest.tar.bz2; then 777 debug " changed from unstable-latest" 778 save_state "unstable" 779 else 780 debug " not changed from unstable-latest" 781 fi 782 else 578 783 save_state "unstable" 579 784 fi 580 else581 save_state "unstable"582 fi785 786 done 787 583 788 ;; 584 789 585 790 stabilize) 791 context_config "$VSNAME" || fatal "Aborting (error $?)." 586 792 if [ -z "$MILESTONE" ]; then 587 793 stabilize_state "testing-latest" … … 596 802 597 803 test) 598 milestone_version "stable-200507040202" 599 milestone_version "testing-latest" 600 milestone_version "testing-200507030047" 601 milestone_version "testing-200507030047qsfd" 602 milestone_date "stable-200507040202" 603 milestone_date "testing-latest" 604 milestone_date "testing-200507030047" 605 milestone_date "testing-200507030047qsfd" 606 (is_latest testing-latest && echo oui) || echo non 607 (is_latest testing-200507031821 && echo oui) || echo non 608 (is_latest stable-200507031831 && echo oui) || echo non 609 (is_latest stable-200507040202 && echo oui) || echo non 804 for i in "" $VSNAMES; do 805 res=0 806 context_config "$i" || res=$? 807 if [ $res -ne 0 ]; then 808 warning "-------- Ignoring" \ 809 "`if [ -z $i ]; then \ 810 echo 'the host system'; \ 811 else \ 812 echo VServer $i; fi` (error $res)" 813 continue 814 fi 815 milestone_version "stable-200507040202" 816 milestone_version "testing-latest" 817 milestone_date "testing-latest" 818 #report_changes "testing-latest" | email "testing-$DATE" 819 done 610 820 ;; 611 821 debian/branches/upstream/current/metche.8
r115 r181 1 .\"Generated by db2man.xsl. Don't modify this, modify the source. 2 .de Sh \" Subsection 3 .br 4 .if t .Sp 5 .ne 5 6 .PP 7 \fB\\$1\fR 8 .PP 9 .. 10 .de Sp \" Vertical space (when we can't use .PP) 11 .if t .sp .5v 12 .if n .sp 13 .. 14 .de Ip \" List item 15 .br 16 .ie \\n(.$>=3 .ne \\$3 17 .el .ne 3 18 .IP "\\$1" \\$2 19 .. 20 .TH "METCHE" 8 "" "" "" 21 .SH NAME 1 .\" Title: metche 2 .\" Author: 3 .\" Generator: DocBook XSL Stylesheets v1.70.1 <http://docbook.sf.net/> 4 .\" Date: 09/16/2006 5 .\" Manual: 6 .\" Source: 7 .\" 8 .TH "METCHE" "8" "09/16/2006" "" "" 9 .\" disable hyphenation 10 .nh 11 .\" disable justification (adjust text to left margin only) 12 .ad l 13 .SH "NAME" 22 14 metche \- reducing root bus factor 23 15 .SH "SYNOPSIS" 24 .ad l25 .hy 026 16 .HP 7 27 \fBmetche\fR {\fBcron\fR | \fBreport\ [{\fBstable\fR\ |\ \fBtesting\fR\ |\ \fBunstable\fR}\-\fIYYYYMMDDHHMM\fR]\fR | \fBlist\fR | \fBstabilize\ [testing\-\fIYYYYMMDDHHMM\fR]\fR} 28 .ad 29 .hy 30 17 \fBmetche\fR [\-h\ \fIvserver\fR] {[report\ [\ {[stable]\ |\ [testing]\ |\ [unstable]}\-\fIYYYYMMDDHHMM\fR\ ]] | [list] | [stabilize\ [testing\-\fIYYYYMMDDHHMM\fR]]} 31 18 .SH "DESCRIPTION" 32 33 19 .PP 34 metche is a tool meant to facilitate collective sysadmin by monitoring changes in the system configuration\&. 35 20 metche is a tool meant to ease collective system administration by monitoring changes in the system configuration. 36 21 .PP 37 metche basic usage is to monitor changes in a directory, usually \fI/etc\fR ; optionally, metche can also monitor: 38 39 .TP 3 22 metche basic usage is to monitor changes in a directory, usually 23 \fI/etc\fR 24 ; optionally, metche can also monitor: 25 .TP 3n 40 26 \(bu 41 27 one or more user maintained changelog files, 42 .TP 28 .TP 3n 43 29 \(bu 44 the state of Debian packages and versions \&.45 . LP46 30 the state of Debian packages and versions. 31 .sp 32 .RE 47 33 .PP 48 metche should be installed with a cronjob that regularly runs to automatically save the system state as needed\&. These states are saved in a way similar to the Debian development model: 49 50 .TP 3 34 metche should be installed with a cronjob that regularly runs to automatically save the system state as needed. These states are saved in a way similar to the Debian development model: 35 .TP 3n 51 36 \(bu 52 \fIunstable\fR states are saved as soon as a change is detected\&. They are kept until a new \fItesting\fR state appears\&. 53 .TP 37 \fIunstable\fR 38 states are saved as soon as a change is detected. They are kept until a new 39 \fItesting\fR 40 state appears. 41 .TP 3n 54 42 \(bu 55 \fItesting\fR states is created from the last \fIunstable\fR state that has not been changed after a short amount of time (by default, one hour)\&. Old \fIunstable\fR states are deleted afterwards\&. 56 .TP 43 \fItesting\fR 44 states is created from the last 45 \fIunstable\fR 46 state that has not been changed after a short amount of time (by default, one hour). Old 47 \fIunstable\fR 48 states are deleted afterwards. 49 .TP 3n 57 50 \(bu 58 \fIstable\fR states are created from the last \fItesting\fR state, either manually, or after a long amount of time (by default, 3 days)\&. Old \fItesting\fR states are deleted afterwards\&. 59 .LP 60 51 \fIstable\fR 52 states are created from the last 53 \fItesting\fR 54 state, either manually, or after a long amount of time (by default, 3 days). Old 55 \fItesting\fR 56 states are deleted afterwards. 57 .sp 58 .RE 61 59 .PP 62 When a new \fItesting\fR state is saved, an email is sent to a configurable address, giving an overwiew of the differences with the previous \fItesting\fR\&. A notification is also sent when a new \fIstable\fR state is saved\&. 63 60 When a new 61 \fItesting\fR 62 state is saved, an email is sent to a configurable address, giving an overwiew of the differences with the previous 63 \fItesting\fR. A notification is also sent when a new 64 \fIstable\fR 65 state is saved. 64 66 .PP 65 metche's configuration is read from \fI/etc/metche\&.conf\fR\&. Various settings like changelog monitoring or time between system state switches are described there\&.66 67 metche's configuration is read from 68 \fI/etc/metche.conf\fR. Various settings like changelog monitoring or time between system state switches are described there. 67 69 .SH "OPTIONS" 68 70 .PP 71 If 72 \fB\-h\fR 73 \fIVSERVER\fR 74 is specified, the VServer 75 \fIVSERVER\fR 76 is operated on instead of the host system. This, along with the 77 \fBVSNAMES\fR 78 option, allows to monitor several VServers running on the system. 69 79 .PP 70 80 One of the following commands must be specified on the command line: 71 72 .TP 81 .TP 3n 73 82 \fBreport\fR 74 When run with the \fBreport\fR command, metche displays a report against the specified saved state, or if unspecified, against the latest testing state\&. This is useful when you have broken your system and want to know which changes have been made since a given, known working, system state\&. 75 76 .TP 83 When run with the 84 \fBreport\fR 85 command, metche displays a report against the specified saved state, or if unspecified, against the latest testing state. This is useful when you have broken your system and want to know which changes have been made since a given, known working, system state. 86 .TP 3n 77 87 \fBlist\fR 78 When run with the \fBlist\fR command, metche displays a list of all the saved states\&. 79 80 .TP 88 When run with the 89 \fBlist\fR 90 command, metche displays a list of all the saved states. 91 .TP 3n 81 92 \fBstabilize\fR 82 When run with the \fBstabilize\fR command, metche turns a "testing state" into a "stable state"\&. By default, it will use the last "testing state", but this can be overriden by giving a specific state as argument\&. 83 84 .TP 93 When run with the 94 \fBstabilize\fR 95 command, metche turns a "testing state" into a "stable state". By default, it will use the last "testing state", but this can be overriden by giving a specific state as argument. 96 .TP 3n 85 97 \fBcron\fR 86 This command should not be called manually, but used from a cronjob\&. When called, it can perform various operations like: saving "unstable", "testing" or "stable" states as needed and sending reports and notification if configured to do so\&. 87 98 This command should not be called manually, but used from a cronjob. When called, it can perform various operations like: saving "unstable", "testing" or "stable" states as needed and sending reports and notification if configured to do so. This command does not support the 99 \fB\-h\fR 100 option. 88 101 .SH "FILES" 89 90 102 .PP 91 \fI/etc/metche \&.conf\fR contains metche configuration\&.92 103 \fI/etc/metche.conf\fR 104 contains metche configuration. 93 105 .PP 94 When configured to monitor one changelog, \fI\fBCHANGELOG_FILE\fR\fR (default \fI/root/Changelog\fR)\&. 95 106 When configured to monitor one changelog, 107 \fBCHANGELOG_FILE\fR 108 (default: 109 \fI/root/Changelog\fR). 96 110 .PP 97 When configured to monitor multiple changelogs, \fI\fBCHANGELOG_DIR\fR/*/Changelog\fR (default : \fI/root/changelogs\fR)\&. 98 111 When configured to monitor multiple changelogs, 112 \fICHANGELOG_DIR/*/Changelog\fR 113 (default: 114 \fI/root/changelogs\fR). 99 115 .PP 100 System states are saved in \fI\fBBACKUP_DIR\fR\fR (default \fI/var/lib/metche)\fR\&. 101 116 System states are saved in 117 \fBBACKUP_DIR\fR 118 (default: 119 \fI/var/lib/metche)\fR. 102 120 .SH "SECURITY" 103 104 121 .PP 105 metche is able to use GnuPG to encrypt the email it sends, but does not by default; just enable the \fBENCRYPT_EMAIL\fR configuration option, and make sure \fBEMAIL_ADDRESS\fR' public key is in root's keyring, trusted enough to be used blindly by metche\&. 106 122 metche is able to use GnuPG to encrypt the email it sends, but does not by default; just enable the 123 \fBENCRYPT_EMAIL\fR 124 configuration option, and make sure 125 \fBEMAIL_ADDRESS\fR' public key is in root's keyring, trusted enough to be used blindly by metche. 107 126 .PP
