Archive:CLI Showcase

From SEPsesam

Copyright © SEP AG 1999-2024. 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.

Icon archived docs.png THE CONTENT OF THIS PAGE IS OUTDATED
SEP AG has discontinued support for obsolete SEP sesam versions. Instructions are still available for these SEP sesam products, however, SEP AG accepts no responsibility or liability for any errors or inaccuracies in the instructions or for the incorrect operation of obsolete SEP sesam software. It is strongly recommended that you update your SEP sesam software to the latest version. For the latest version of SEP sesam documentation, see documentation home.

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.

  1. 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
  2. If you like to recreate your work from the Sesam base configuration do the following:
    1. 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).
    2. 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
    3. Run your SEP sesam CLI script again

New SEP sesam Environment (backup environment example)

This chapter describes the requirements to create a new SEP sesam environment as showcase.

Network overview

CLIexample network 42.jpg

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 smsrv should work a disk store with a mediapool for backup to disk and a 2nd VTL-based mediapool as tape emulation.
  • The backup client xubl01 should act as SEP sesam Remote Device Server (RDS) with a mediapool for backup to disk.
  • Create the necessary backup tasks of all Linux and the Windows backup clients.
  • Backup the Linux server configurations (/etc directory).
  • Combine different backup tasks into taskgroups.
  • Backup strategy
    • Linux and Windows server systems and configs on every weekend as full backup.
    • The data should be backing up from Monday to Thursday incremental and every Friday full.
    • On the last day of every month backup the Linux server systems and the user data to the remote disk.
    • Migration the disk backups to a different VTL mediapool ...
      • ... from Tuesday to Friday migrate all backups from mediapool Local_Disk to vtldisk with time range from yesterday to today.
      • ... on Monday migrate all backups from mediapool Local_Disk to vtldisk with time range from 3 days before up to today.
  • Start two command events
    • The 1st generate a list of the used media for backup and migration on the last Sesam day
    • 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 database and 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 smsrv.sep.de -L 11

#--- 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 w2k8r2 -o "Windows Server 2008 R2" -L 12 -i "Application server"
sm_cmd add client w2k12 -o "Windows Server 2012" -L 13 -i "MS-SQL server"

#--- clean the install config
sm_cmd remove schedules Daily-2200
sm_cmd remove schedules Weekly
sm_cmd remove mediapool smsrv
sm_cmd remove drivegroups Tape_Drives

#--- drivegroups and drives
sm_cmd add drivegroup vtl_drives -i "Drives for vtl based mediapool vtldisk"
sm_cmd add drive 2 -t DISK_HARD -d disk2 -S smsrv.sep.de -G vtl_drives -n 3
echo "XXX wait 30 seconds until sm_config_drives has been finished to add the drive processes XXX"
sleep 30

#--- create 2x mediapools to disk and 1x VTL based as tape emulation
sm_cmd add mediaPool vtldisk -G vtl_drives -e 3 -i "Backup to disk 1" -n 5000 -D "/sm_disk/vtl"
sm_cmd add datastore ds_local -c -1 -h -5 -p /sm_disk2 -G dg_ds_local -m Local_Disk -e 5 -o noconfig
sm_cmd add datastore ds_rds01 -c -1 -h -5 -S xubl01 -p /cli/rdsdisk -G dg_ds_rds01 -m Remote_Disk -e 3
echo "XXX wait 20 seconds until sm_config_drives has been finished to add the drive processes XXX"
sleep 20

#--- register 4 new media to VTL
sm_cmd start inventory 0 -d 2 -i take -m vtldisk -t DISK_1000 -s 0-3
echo "XXX wait 20 seconds until the archive adjustment has been finished XXX"
sleep 20

#--- create tasks
sm_cmd add task w2k8r2_all -c w2k8r2 -s all -V 1 -i "Complete system"
sm_cmd add task w2k8r2_system_state -c w2k8r2 -t "System Recovery" -s all -i "Windows system recovery backup"
sm_cmd add task w2k8r2_app-config -c w2k8r2 -s D:/application/config -i "Application configuration backup"
sm_cmd add task w2k12_all -c w2k12 -s all -V 1 -i "Complete system"
sm_cmd add task w2k12_system_state -c w2k12 -t "System Recovery" -s all -i "Windows system recovery backup"
sm_cmd add task w2k12_DB_all -c w2k12 -t "MS SQL Server" -s all -i "All databases"
sm_cmd modify task smsrv_all -x "\./opt/sesam$,\./var/opt/sesam$" -i "Sesam server system"
sm_cmd add task smsrv_diskinfo -c smsrv.sep.de -s disk_info -i "Disk_info for BSR recovery"
sm_cmd add task smsrv_etc -c smsrv.sep.de -s /etc -i "Server config"
sm_cmd add task xubl01_all -c xubl01 -s all
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_all -c xc5 -s all
sm_cmd add task xc5_data -c xc5 -s /data* -i "idirectories data1 data2 data3"
sm_cmd add task xc5_etc -c xc5 -s /etc -i "Server config"

#--- taskgroups & taskgroup relations
sm_cmd add taskgroup Server_Config
sm_cmd add taskgrouprelation Server_Config -j w2k8r2_system_state -n 0
sm_cmd add taskgrouprelation Server_Config -j xubl01_etc -n 1
sm_cmd add taskgrouprelation Server_Config -j smsrv_etc -n 2
sm_cmd add taskgrouprelation Server_Config -j xc5_etc -n 3
sm_cmd add taskgrouprelation Server_Config -j w2k12_system_state -n 4
sm_cmd add taskgrouprelation Server_Config -j smsrv_diskinfo -n 5
sm_cmd add taskgroup Server_Complete
sm_cmd add taskgrouprelation Server_Complete -j w2k8r2_all -n 0
sm_cmd add taskgrouprelation Server_Complete -j smsrv_all -n 1
sm_cmd add taskgrouprelation Server_Complete -j w2k12_all -n 2
sm_cmd add taskgrouprelation Server_Complete -j xubl01_all -n 3
sm_cmd add taskgrouprelation Server_Complete -j xc5_all -n 4
sm_cmd add taskgroup Data
sm_cmd add taskgrouprelation Data -j w2k8r2_app-config -n 0
sm_cmd add taskgrouprelation Data -j xc5_data -n 1

#--- migration tasks
sm_cmd add migrationtask Mig_Local_Disk-to-vtldisk -m Local_Disk -d 3 -M vtldisk -D 2 -n 1 -B "-1" -E "0" -i "Everything from yesterdays backup"

#--- create schedules and events
#--- Server system every Saturday, 10:00 p.m. full
sm_cmd add schedule Server_Complete_Sa -T WEE -d "sa" -s 22:00
sm_cmd add taskevent auto -G Server_Complete -x Server_Complete_Sa -m Local_Disk -l F
#--- Server configuration every Saturday, 02:00 p.m. full
sm_cmd add schedule Server_Config_Sa -T WEE -d "sa" -s 14:00
sm_cmd add taskevent auto -G Server_Config -x Server_Config_Sa -m Local_Disk -l F
#--- Data backup Monday - Thursday, 09:00 p.m. inc
sm_cmd add schedule Data_Mo-Th -T WEE -d "mo,tu,we,th" -s 21:00
sm_cmd add taskevent auto -G Data -x Data_Mo-Th -m Local_Disk -l I
#--- Data backup every Friday, 09:00 p.m. full
sm_cmd add schedule Data_Fr -T WEE -d "fr" -s 21:00
sm_cmd add taskevent auto -G Data -x Data_Fr -m Local_Disk -l F
#--- Daily database backup, 11:30 p.m.
sm_cmd add schedule Database_daily -T DAY -s 23:30
sm_cmd add taskevent auto -j w2k12_DB_all -x Database_daily -m Local_Disk -l F
#-- Migrations Tuesday - Friday relative from yesteriday to today
sm_cmd add schedule Mig_Local_Disk-to-vtl_Tu-Fr -T WEE -d "tu,we,th,fr" -s 10:00
sm_cmd add migrationevent auto -x Mig_Local_Disk-to-vtl_Tu-Fr -R Mig_Local_Disk-to-vtldisk -p 1 -M vtldisk -D 2 -B "-1"
#-- Migrations Monday relative from last friday to monday
sm_cmd add schedule Mig_Local_Disk-to-vtl_Mo -T WEE -d "mo" -s 10:00
sm_cmd add migrationevent auto -x Mig_Local_Disk-to-vtl_Mo -R Mig_Local_Disk-to-vtldisk -p 1 -M vtldisk -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_Complete -x Monthly_Backup-to-RDS -m Remote_Disk -l F
sm_cmd add taskevent auto -G Data -x Monthly_Backup-to-RDS -m Remote_Disk -l F

#--- create and configure command events
cp /srv/CLI/SEP-Event/list-used-media.sh /srv/CLI/SEP-Event/sm_check4client.sh ${gv_ro_bin}
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 smsrv.sep.de -u root -C "/opt/sesam/bin/sesam/list-used-media.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 21:30
sm_cmd add command Start_Notebook_Backup -c smsrv.sep.de -u root -C "/opt/sesam/bin/sesam/sm_check4client.sh xc5 xc5_data vtldisk 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 "smsrv.sep.de" -h localhost -t root@smsrv.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 vtldisk -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 Local_Disk -l F

#--- start test backups of single task and task group to local and remote disks
sm_cmd backup -j xc5_data -m Local_Disk -l F
sm_cmd backup -G Server_Config -m Local_Disk -l F
sm_cmd backup -j smsrv_diskinfo -m Remote_Disk -l F
echo "XXX wait 90 seconds ..."
sleep 90
echo "...for the first Sesam backup of the metadata to the mediapool vtldisk XXX"
sm_cmd backup -j SESAM_BACKUP -m vtldisk -l F