#!/bin/sh
#  File: sbc_pre_event_group
#
#
# Sesam PRE event procedure for Linux servers
#
# Description: 
#    This script is called from SEP sesam kernel, before 
#    tasks belonging to a task group are read from Sesam database.
#    It gives the user a possibility to add/delete/modify tasks
#    belonging to a task group.
#
# Parameters:
#    $1 = task group name
#
# Help:
#    See https://wiki.sepsoftware.com/wiki/index.php/Automating_Backup_of_Virtual_Machines
#    or check help options of SEP sesam command line interface (CLI): 'sm_cmd help dir client' or 'sm_cmd help taskgen'
#
# Examples:
#             
#    Create vSphere backup tasks: 
#       sm_cmd "dir" -F JSON "vsphere" -k 'Backup required=yes' /vcenter-srv| sm_cmd add taskgen "vsphere_{{client}}_{{source}}_{{count}}"  -t "VMware vSphere" -O "source_not_found,remove_non_existing" -G $1 -a refresh=true -T _CBT -f - 
#
#    Create Hyper-V backup tasks:
#       sm_cmd dir -F JSON hypervisor "hyperv-srv" "-i" "StartingWith.*" | sm_cmd add taskgen "hyperv_gen_{{client}}_{{source}}_{{count}}" -O "source_not_found,remove_non_existing" -t "Hyper-V" -G $1 -f -
#
#    Create Citrix XenServer backup tasks:
#       sm_cmd dir -F JSON hypervisor "xenserver.sep.de" -k "powerState=Running" | sm_cmd add taskgen "citrix_gen_{{client}}_{{source}}_{{count}}" -O "source_not_found" -t "Citrix XenServer" -G $1 -f -
#
#    Create RHV backup tasks:
#       sm_cmd dir -F JSON hypervisor "rhv.srv.sep.de" | sm_cmd add taskgen "rhv_gen_{{client}}_{{source}}_{{count}}" -O "source_not_found" -t "RHEV" -G $1 -f -
#
#    Create Azure-VM backup tasks:
#       sm_cmd dir -F JSON hypervisor "azure-tenant-uuid" | sm_cmd add taskgen "{{substring(0,13) client_short}}{{underPrefix source_item[3]}}{{underPrefix source_last_item}}{{underPrefix count_optional}}" -O "source_not_found" -t "AZURE" -G $1 -f -
#
#    Create MS SQL Server backup tasks:
#       sm_cmd dir -F json client -o recursive "mssql-srv/MS SQL Server:" | sm_cmd add taskgen "mssql_gen_{{client}}_{{source_last_item}}{{underPrefix count_optional}}" -t "MS SQL Server" -G $1 -f -
#
#    Create MS SQL Server backup tasks - only with attribute "archive_mode=full":
#       sm_cmd dir -F json client -o recursive -k "archive_mode=full" "mssql-srv/MS SQL Server:" | sm_cmd add taskgen "mssql_gen_{{client}}_{{source_last_item}}{{underPrefix count_optional}}" -t "MS SQL Server" -G $1 -f -
#
#    Create Postgres backup tasks:
#       sm_cmd dir -F json client "/postgres-server/PostgreSQL:"|sm_cmd add taskgen "pgsql_gen_-{{client}}_{{source_last_item}}{{underPrefix count_optional}}" -t "PostgreSQL" -G $1 -f -

