Nightly Backups

backup_nightly_programs.cfg defines a shell script to perform nightly backups of important data directories.  Note, by means of the per-system #if directives, how different things are backed up, and backed up to different places, on different backup servers.

///////////////////////////////////////////////////////////////////////////////
//
// backup_nightly_programs.cfg
//
///////////////////////////////////////////////////////////////////////////////

#if backupserver // | ottawa | calgary | winnipeg

backup_nightly.sh               // do nightly backups

        #!=bash
        
        RSYNC=/usr/bin/rsync
        SSH=/usr/bin/ssh
        
#  if ottawa
        # backup ottawa's /home/brahms
        
// see calgary below
        #$RSYNC -vap --delete --rsh=$SSH /home/brahms calgary-bak:/home
        
        # backup /home/pikt
        
        $RSYNC -vap --delete --rsh=$SSH /home/pikt /arc/ottawa/home
        $RSYNC -vap --delete --rsh=$SSH /home/pikt calgary-bak:/arc/ottawa/home
        
#  endif

#  if calgary
        # backup ottawa's /home/brahms
        
        $RSYNC -vap --delete --rsh=$SSH ottawa-bak:/home/brahms /home
        
        # backup toronto's /home/brahms
        
        $RSYNC -vap --delete --rsh=$SSH
               toronto-bak:/home/brahms /home/brahms_toronto
        
#  endif

#  if backupserver & ! winnipeg
        # backup /etc
        
        $RSYNC -vap --delete --rsh=$SSH ottawa-bak:/etc /arc/ottawa
        $RSYNC -vap --delete --rsh=$SSH toronto-bak:/etc /arc/toronto
        $RSYNC -vap --delete --rsh=$SSH calgary-bak:/etc /arc/calgary
        $RSYNC -vap --delete --rsh=$SSH vancouver-bak:/etc /arc/vancouver
        $RSYNC -vap --delete --rsh=$SSH montreal-bak:/etc /arc/montreal
        $RSYNC -vap --delete --rsh=$SSH winnipeg-bak:/etc /arc/winnipeg
        
#  endif

#  if backupserver & ! winnipeg
        # backup /usr/local
        
        $RSYNC -vap --delete --rsh=$SSH ottawa-bak:/usr/local /arc/ottawa/usr
        $RSYNC -vap --delete --rsh=$SSH toronto-bak:/usr/local /arc/toronto/usr
        $RSYNC -vap --delete --rsh=$SSH calgary-bak:/usr/local /arc/calgary/usr
        $RSYNC -vap --delete --rsh=$SSH vancouver-bak:/usr/local
                                        /arc/vancouver/usr
        $RSYNC -vap --delete --rsh=$SSH montreal-bak:/usr/local /arc/montreal/usr
        $RSYNC -vap --delete --rsh=$SSH winnipeg-bak:/usr/local /arc/winnipeg/usr
        
#  endif

#  if winnipeg
        # backup /var/www

        $RSYNC -vap --delete --rsh=$SSH toronto-bak:/var/www /var_www

        # backup /var/log/httpd

        $RSYNC -vap --delete --rsh=$SSH toronto-bak:/var/log/httpd /var_log_httpd

#  elsif backupserver
        # backup /var/www
        
        $RSYNC -vap --delete --rsh=$SSH ottawa-bak:/var/www /arc/ottawa/var
        $RSYNC -vap --delete --rsh=$SSH toronto-bak:/var/www /arc/toronto/var
        $RSYNC -vap --delete --rsh=$SSH vancouver-bak:/var/www /arc/vancouver/var
        
        # backup /var/log/httpd

        $RSYNC -vap --delete --rsh=$SSH
               toronto-bak:/var/log/httpd /arc/toronto/var/log
        $RSYNC -vap --delete --rsh=$SSH
               vancouver-bak:/var/log/httpd /arc/vancouver/var/log
        
#  endif

#  if backupserver
        # backup /usr/lib/mailman
#    if winnipeg
        $RSYNC -vap --delete --rsh=$SSH toronto-bak:/usr/lib/mailman /usr/lib
#    else
        $RSYNC -vap --delete --rsh=$SSH
               toronto-bak:/usr/lib/mailman /arc/toronto/usr/lib
#    endif

        # backup /var/lib/mailman
#    if winnipeg
        $RSYNC -vap --delete --rsh=$SSH toronto-bak:/var/lib/mailman /var/lib
#    else
        $RSYNC -vap --delete --rsh=$SSH
               toronto-bak:/var/lib/mailman /arc/toronto/var/lib
#    endif
        
#  endif

#endif  // backupserver // | ottawa | calgary | winnipeg

///////////////////////////////////////////////////////////////////////////////

On the piktmaster system, we would install the backup_nightly.sh script to the PIKT slave system ottawa, for example, with the command:

# piktc -iv +P backup_nightly.sh +H ottawa

For more examples, see Samples.

 
Home | FAQ | News | Intro | Samples | Tutorial | Reference | Software
Developer's Notes | Licensing | Authors | Pikt-Users | Pikt-Workers | Related Projects | Site Index | Privacy Policy | Contact Us
Page best viewed at 1024x768 or greater.   Page last updated 2019-01-12.   This site is PIKT® powered.
Copyright © 1998-2019 Robert Osterlund. All rights reserved.
Home FAQ News Intro Samples Tutorial Reference Software
PIKT Logo
PIKT Page Title
View sample
backup system
configuration
Pikt script