CLI Showcase
From SEPsesam
(C)SEP AG
Copyright 1999-2011 by SEP AG. All Rights reserved.
Any form of reproduction of the contents or parts of this manual is allowed only with the express written permission from SEP AG. When compiling and designing user documentation SEP AG uses great diligence and attempts to deliver accurate and correct information. However, SEP AG cannot issue a guarantee for the contents of this manual.
Contents |
Example per small Use Case
Operate test scenarios
To operate test scenarios in many cases you have to clear the SEP sesam environment after the test and re-run scripts. The following sequence offers you a workaround to do that.
- Right after a new installation of a SEP sesam Server has finished export the database
sm_db export -f <smdb_file>
Example: sm_db export -f /srv/sesamdb_myserver.sql - If you like to recreate your work from the Sesam base configuration do the following:
- Clear the Sesam-DB by recreating the database
sm_db import -f /opt/sesam/skel/db/<dbtype>/sesam_db.sql
<dbtype> means the type of database your SEP sesam is using (sqlite for SQlite or pg for PostgreSQL). - Import the <smdb_file> to get the basic status after installation of the SEP sesam Server
sm_db import -f <smdb_file>
Example: sm_db import -f /srv/sesamdb_myserver.sql - Run your SEP sesam CLI script again
- Clear the Sesam-DB by recreating the database
New SEP sesam Environment (backup environment example)
This chapter describes the requirements to create a new SEP sesam environment as showcase.
Network overview
Description
The new SEP sesam environment should accomplish the following requirements.
- Remove the SEP sesam install defaults.
- Register a Linux and a Windows backup client
- On SEP sesam Server smsmrv should work a disk store with 2 mediapools for backup to disk.
- The backup client xubl01 should act as SEP sesam Remote Device Server (RDS) with a mediapool for backup to disk.
- Create the necessary jobs for restore of the SEP sesam Server and the Windows client.
- Backup the Linux server configurations (/etc directory).
- Combine different backup tasks into taskgroups.
- Backup strategy
- Linux server systems and configs from Monday to Friday as full backup.
- The Windows server as full backup every weekend.
- The Windows server files backup incremental from Monday to Friday.
- On the last day of every month backup the Linux server systems to the RDS disk.
- Migration the disk backups to a different mediapool ...
- ... from Tuesday to Friday migrate all backups from mediapool vda to vdb from yesterday to today.
- ... on Monday migrate all backups from mediapool vda to vdb from 3 days before up to today.
- Start two command events
- The 1st generate a list of the used media for backup and migration
- The 2nd is for Notebook backup. It checks if the Notebook is connected into the network. If yes, then the backup will be started.
- Change the sm_newday event from running at 08:00 a.m. every day to running at 06:00 p.m. from Monday to Friday.
- Activate the SEP sesam Server notify, alarm and disaster interfaces by copying them from the templates to ./bin/sesam directory
- Create an email account sesam for sending standard emails raised by the interface file events.
- Create a SEP sesam metadata backup twice a day.
- Provoke some test backups.
- At the end execute a SEP sesam metadata backup. After that you can check if an email has been sent.
Script file
The following configuration can be executed line by line. All lines beginning with a hash sign are comments. Either you copy sm_cmd... commands line by line to a console of the SEP sesam Server and execute it or you can copy them to a script file to run it in one step and automatically (e.g. Create_Sesam_Env.sh below).
#!/bin/bash
#--- load SEP sesam profile
source /var/opt/sesam/var/ini/sesam2000.profile
#--- create locations
sm_cmd modify location 0 -L "Germany"
sm_cmd add location 11 -p 0 -L "Munich"
sm_cmd add location 12 -p 0 -L "Berlin"
sm_cmd add location 13 -p 0 -L "Cologne"
#--- move SEP sesam Server to location "Munich" regardless of the SEP sesam Server name
sm_cmd modify client smsrvt.sep.de -L 11
#--- sm_cmd sql "update clients set location=11 where client_id=0"
#--- add clients
sm_cmd add client xubl01 -o "LINUX" -a SSH -L 13 -i "File Server and RDS" -r "11002-11005"
sm_cmd add client xc5 -o "LINUX" -L 11 -i "Proxy server and NFS"
sm_cmd add client xp01 -o "Windows XP" -L 12 -i "GUI client"
#--- clean the install config
sm_cmd remove mediaevents 1
sm_cmd remove schedules Daily_0810
sm_cmd remove schedules Daily-2200
sm_cmd remove schedules Weekly
sm_cmd remove media DISK00004
sm_cmd remove media DISK00003
sm_cmd remove media DISK00002
#--- reset block time than the medium can be deleted
sm_cmd modify media DISK00001 -e 2010-01-01 09:00:00
sm_cmd remove media DISK00001
sm_cmd remove mediapool DISK
sm_cmd remove mediapool smsrvt
sm_cmd remove drive 1
echo "XXX wait 15 seconds until sm_config_drives has been finished to remove the drive processes XXX"
sleep 15
sm_cmd remove drivegroups diskdrives
sm_cmd remove drivegroups Tape_Drives
#--- drivegroups and drives
sm_cmd add drivegroup vda_drives -i "Drives for mediapool vda"
sm_cmd add drivegroup vdb_drives -i "Drives for mediapool vdb"
sm_cmd add drivegroup rds_drives -i "Drives for RDS xubl01"
sm_cmd add drive 1 -t DISK_HARD -d disk1 -S smsrvt.sep.de -G vda_drives -n 3 -o noconfig
sm_cmd add drive auto -t DISK_HARD -d disk2 -S smsrvt.sep.de -G vdb_drives -n 2 -o noconfig
sm_cmd add drive auto -t DISK_HARD -d disk3 -S xubl01 -G rds_drives -n 5
echo "XXX wait 30 seconds until sm_config_drives has been finished to add the drive processes XXX"
sleep 30
#--- create an additional media type
sm_cmd sql "INSERT INTO capacities (drive_type,media_type,size,protection) VALUES ('DISK_HARD','DISK_500','512000','f')"
#--- create mediapools 2x 5GB and on the RDS 2GB
sm_cmd add mediaPool vda -G vda_drives -e 3 -i "Backup to disk 1" -n 5000 -D "/sm_disk/vda"
sm_cmd add mediaPool vdb -G vdb_drives -e 5 -i "Backup to disk 2" -n 5000 -D "/sm_disk/vdb"
sm_cmd add mediaPool rdsdisk -G rds_drives -e 25 -i "Monthly backups" -n 2000 -D "/cli/rdsdisk"
#--- register new media
sm_cmd start inventory 0 -d 1 -i take -m vda -t DISK_500 -s 0-9
echo "XXX wait 20 seconds until the archive adjustment has been finished XXX"
sleep 20
sm_cmd start inventory 0 -d 2 -i take -m vdb -t DISK_1000 -s 0-4
echo "XXX wait 20 seconds until the archive adjustment has been finished XXX"
sleep 20
sm_cmd start inventory 0 -d 3 -i take -m rdsdisk -t DISK_500 -s 0-3
echo "XXX wait 30 seconds until the archive adjustment has been finished XXX"
sleep 30
#--- create tasks
sm_cmd add task xp01_all_VSS -c xp01 -s all -o "-o vss" -i "Complete system"
sm_cmd add task xp01_system_state -c xp01 -t "System Recovery" -s all -i "Windows systemstate backup"
sm_cmd modify task smsrvt_all -x "\./opt/sesam$,\./var/opt/sesam$" -i "Sesam server system"
sm_cmd add task smsrvt_diskinfo -c smsrvt.sep.de -s disk_info -i "Disk info for DR Sesam server"
sm_cmd add task smsrvt_etc -c smsrvt.sep.de -s /etc -i "Server config"
sm_cmd add task xubl01_var-log -c xubl01 -s /var/log
sm_cmd add task xubl01_etc -c xubl01 -s /etc -i "Server config"
sm_cmd add task xc5_var -c xc5 -s /var
sm_cmd add task xc5_etc -c xc5 -s /etc -i "Server config"
#--- taskgroups & taskgroup relations
sm_cmd add taskgroup Server_Systems
sm_cmd add taskgrouprelation Server_Systems -j smsrvt_etc -n 0
sm_cmd add taskgrouprelation Server_Systems -j xubl01_etc -n 1
sm_cmd add taskgrouprelation Server_Systems -j xc5_etc -n 2
sm_cmd add taskgroup Windows_Systems
sm_cmd add taskgrouprelation Windows_Systems -j xp01_system_state -n 0
sm_cmd add taskgrouprelation Windows_Systems -j xp01_all_VSS -n 1
#--- migration tasks
sm_cmd add migrationtask Mig_vda-to-vdb -m vda -d 1 -M vdb -D 2 -n 1 -B "-1" -E "0" -i "Everything from yesterdays backup"
#--- create schedules and events
#--- Monday - Friday, 08:00 p.m. full
sm_cmd add schedule Server_Systems_Mo-Fr -T WEE -d "mo,tu,we,th,fr" -s 20:00
sm_cmd add taskevent auto -G Server_Systems -x Server_Systems_Mo-Fr -m vda -l F
#--- Saturday, 02:00 p.m. full
sm_cmd add schedule Windows_Systems_Sa_Full -T WEE -d "sa" -s 14:00
sm_cmd add taskevent auto -G Windows_Systems -x Windows_Systems_Sa_Full -m vda -l F
#--- Monday - Friday, 10:00 p.m. inc
sm_cmd add schedule Windows_File_Mo-Fr_Inc -T WEE -d "mo,tu,we,th,fr" -s 22:00
sm_cmd add taskevent auto -j xp01_all_VSS -x Windows_File_Mo-Fr_Inc -m vda -l I
#-- Migrations Tuesday - Friday relative minus 1
sm_cmd add schedule Mig_vda-to-vdb_Tu-Fr -T WEE -d "tu,we,th,fr" -s 10:00
sm_cmd add migrationevent auto -x Mig_vda-to-vdb_Tu-Fr -R Mig_vda-to-vdb -p 1 -M vdb -D 2 -B "-1"
#-- Migrations Monday relative minus 3
sm_cmd add schedule Mig_vda-to-vdb_Mo -T WEE -d "mo" -s 10:00
sm_cmd add migrationevent auto -x Mig_vda-to-vdb_Mo -R Mig_vda-to-vdb -p 1 -M vdb -D 2 -B "-3"
#-- Monthly backup
sm_cmd add schedule Monthly_Backup-to-RDS -T MON -D 30 -s 20:00
sm_cmd add taskevent auto -G Server_Systems -x Monthly_Backup-to-RDS -m rdsdisk -l F
#--- create and configure command events
sm_cmd add schedule List_Used_Media_Mo-Fr -T WEE -d "mo,tu,we,th,fr" -s 07:00
sm_cmd add command List_Used_Media -c smsrvt.sep.de -u root -C "/opt/sesam/bin/sesam/list-used-labels.sh"
sm_cmd add commandevent auto -j List_Used_Media -x List_Used_Media_Mo-Fr
sm_cmd add schedule Backup_Notebook_Mo-Fr -T WEE -d "mo,tu,we,th,fr" -s 16:30
sm_cmd add command Start_Notebook_Backup -c smsrvt.sep.de -u root -C "/opt/sesam/bin/sesam/sm_check4client.sh xc5 xc5_var vda F 10"
sm_cmd add commandevent auto -j Start_Notebook_Backup -x Backup_Notebook_Mo-Fr
#--- change sm_newday to Mo - Fr at 06:00 p.m.
sm_cmd modify schedule Newday -T WEE -d "mo,tu,we,th,fr" -s 18:00 -w "23:00"
#--- Prepare the Sesam disaster, notify and alarm interfaces
cp ${gv_ro}/skel/templates/sm_disaster ${gv_ro}/skel/templates/sm_notify ${gv_ro}/skel/templates/sm_alarm ${gv_ro_bin}
#--- create an Email account for send the interface events information
sm_cmd add mailaccount sesam -C "SEP AG" -s "smsrvt.sep.de" -h localhost -t root@smsrvt.sep.de
#--- Sesam metadata backup twice daily
sm_cmd add schedule Sesam_Backup_Mo-Fr_early -T WEE -d "mo,tu,we,th,fr" -s 09:00
sm_cmd add taskevent auto -j SESAM_BACKUP -x Sesam_Backup_Mo-Fr_early -m vdb -l F
sm_cmd add schedule Sesam_Backup_Mo-Fr_late -T WEE -d "mo,tu,we,th,fr" -s 17:30
sm_cmd add taskevent auto -j SESAM_BACKUP -x Sesam_Backup_Mo-Fr_late -m vdb -l F
#--- start test backups of single task and task group to local and remote disks
sm_cmd backup -j xp01_system_state -m vda -l F
sm_cmd backup -G Server_Systems -m vda -l F
sm_cmd backup -j smsrvt_diskinfo -m rdsdisk -l F
echo "XXX wait 90 seconds ..."
sleep 90
echo "...for the first Sesam backup of the metadata to the mediapool vda XXX"
sm_cmd backup -j SESAM_BACKUP -m vdb -l F

