Package: samba
Version: 3.0.14a-6
Severity: important
Tags: patch

Hi,

this also applies to the samba of the stable debian distri.

samba uses many .tdb files, and there is a nice small tool within the
package to dump those files, or check them.

but there is no tool to dump them, rotate them .. if written a small
shell script which should included in some cron.

-------- samba-backup.sh ---------
#!/bin/sh

set -e

PATH=/usr/local/bin:/bin:/usr/bin
DIR=/var/lib/samba/
DATE=-`date "+%Y%m%d-%H%M%S"`

cd $DIR
find /var/lib/samba  -type f -name '*tdb' -print0 | xargs --null 
--no-run-if-empty tdbbackup -s $DATE

FILES=`ls -1 $DIR | sed -e 's/\.tdb-.*//' | uniq`
for d in $FILES; do
 keep --path $DIR --prefix $d --number 5 --reverse --null | xargs --null 
--no-run-if-empty rm
 keep --path $DIR --prefix $d --number 1 --reverse --null | xargs --null 
--no-run-if-empty gzip -q
done
----------------------------------


a small ruby script, for cleanup..
---------- keep -------------
#! /usr/bin/ruby

require 'optparse'

$NULL = nil
$REVERSE = false
$dir = nil
$num_to_keep = 0
$prefix = nil

def show_help(parser, code=0, io=STDOUT)
  io.puts parser
  exit(code)
end
ARGV.options do |opts|
        opts.on_tail("-h", "--help", "Display this help screen") { 
show_help(opts) }
        opts.on("-p", "--path=PATH", String, "path to cleanup") { |$dir| }
        opts.on("-n", "--number=NUMBER", Integer, "number of entries to keep") 
{ |$num_to_keep| }
        opts.on("-x", "--prefix=PREFIX", String, "prefix of files") { |$prefix| 
}
        opts.on("-0", "--null", String, "terminate strings with zero") { $NULL 
= 1 }
        opts.on("-r", "--reverse", String, "process list reverse") { $REVERSE = 
true }
        opts.parse!
end

show_help(ARGV.options,1,STDERR) unless $num_to_keep
show_help(ARGV.options,1,STDERR) if $num_to_keep < 1
show_help(ARGV.options,1,STDERR) unless $dir
show_help(ARGV.options,1,STDERR) unless $prefix

entries = Dir.glob($dir + '/' + $prefix+"*").sort
if !$REVERSE then
        entries.reverse!
end

if entries.length < $num_to_keep
        exit
end

while entries.length > $num_to_keep
        unless $NULL then
                puts entries.pop
        else
                $> << entries.pop << "\0"
        end
end
-----------------



-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.12
Locale: LANG=C, [EMAIL PROTECTED] (charmap=ISO-8859-15)

Versions of packages samba depends on:
ii  debconf [debconf-2.0]       1.4.52       Debian configuration management sy
ii  libacl1                     2.2.29-1.0.1 Access control list shared library
ii  libattr1                    2.4.21-1.0.1 Extended attribute shared library
ii  libc6                       2.3.2.ds1-22 GNU C Library: Shared libraries an
ii  libcomerr2                  1.38-1       common error description library
ii  libcupsys2-gnutls10         1.1.23-11    Common UNIX Printing System(tm) - 
ii  libkrb53                    1.3.6-4      MIT Kerberos runtime libraries
ii  libldap2                    2.1.30-11    OpenLDAP libraries
ii  libpam-modules              0.76-23      Pluggable Authentication Modules f
ii  libpam-runtime              0.76-23      Runtime support for the PAM librar
ii  libpam0g                    0.76-23      Pluggable Authentication Modules l
ii  libpopt0                    1.7-5        lib for parsing cmdline parameters
ii  logrotate                   3.7.1-1      Log rotation utility
ii  netbase                     4.21         Basic TCP/IP networking system
ii  samba-common                3.0.14a-6    Samba common files used by both th

samba recommends no packages.

-- debconf information excluded


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to