PC Backup Script?

Glenn Burkhardt glenn at aoi.ultranet.com
Thu Nov 19 13:59:44 GMT 1998

> I am trying to setup my Sun running samba 1.9.18p10 so that it can 
> backup my dept's PCs.  I can get it to work manually using the 
> smbclient command with no problem.  What I would like to do is have
> a script that is able to take a list of PCs, determine if a PC is online,
> backup that PC, then move on to the next one.  If a PC is down,
> it can report an error to the admin to state that the backup was not
> performed.  Does anybody out there have anything that might
> be able to help me out?
> Thanks in advance,
> Rick Johnson
> The Aerospace Corporation
> 310-336-3588     richard.l.johnson at aero.org

Funny, I was just writing this last night.  We run it each night on a SunOS
system, using cron to start it at 1am.

#! /bin/csh
if ($#argv == 0) then
    set fileno = 0
    set fileno = $1

set SMBC=/usr/local/samba/bin/smbclient
cd /backup
set TAPE=/dev/nrst0

set EXCLUDE=(windows dos xnfs orcadwin MAXPLUS2 emacs \
    MSOffice wpwin60 Acrobat3 engr wpc20 DMI ATI PAGEMGR KPCMS OPLIMIT \
    wpwin60 dell mouse vibra16 teac winmcad win32app acroread acrobat3 \
    bsdl pkware ACADR13 DTEXT23 MCVHDL RECYCLED lotus Corel ACER)

#  Hosts with pcadmin remote access account 
set hlist = ( peddlerII drachma kopek masada sappho tohoten shiva priam fujin )
set olist = ( steve     sandra  johnf glenn  mike   jean    peggy paula jim )
set i = 1
while ($i <= $#hlist)
    echo ping $hlist[$i]
    ping $hlist[$i]
    if ($status) then
    	echo email to $olist[$i] for $hlist[$i] not available
	/usr/ucb/mail -s "Backup for $hlist[$i] failed" $olist[$i] \
		    < /backup/failed.msg
	/usr/ucb/mail -s "Backup for $hlist[$i] failed" backuplist \
		    < /backup/failed.msg
        echo File ${fileno}: $hlist[$i]
        $SMBC \\\\$hlist[$i]\\c "ADMIN-PASSWORD" -TcbX 126 $TAPE \
	    "Program Files" $EXCLUDE >&! $hlist[$i].log
        @ fileno = $fileno + 1
    @ i++

More information about the samba mailing list