Archive:Used Tapes of a Sesam Day
- Deutsch
- English
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.
![]() |
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. |
Contents
Overview
![]() |
See also: Managing Devices and Media – Creating a Command Event – Configuration: Interfaces |
![]() |
Check FAQ for additional information on media management and storage. |
![]() |
Problems? Check the Troubleshooting Guide. |
With SEP sesam, you can get an overview of all media used for backups (mainly tape media) at the end of a backup day (also called Sesam day). First you first have to set a script and then integrate it into SEP sesam by creating a command event in the GUI or using the notify interface.
Configuring a script
To get an overview of all media used for backups, proceed as follows:
- Copy the source code of the script example below to a file, e.g. on Linux List_Used_Media.sh and on Windows List_Used_Media.ps1.
- Then copy this file to
/opt/sesam/bin/sesam
or to<sesam-root>\bin\sesam
. - On Linux, you also need to make sure that a file is executable: chmod +x /opt/sesam/bin/sesam/List_Used_Media.sh
Once done, you can integrate the script into SEP sesam.
Script example
Note that the media of the current backup day will be displayed if no specific date is specified in the script.
On Linux
This example shows the media used for the Day, Week, Month and VMs media pools. Replace the MPOOLS values with the names of the media pools in your SEP sesam environment.
#!/bin/bash ##################################################################### # # Output of tape media that were used at the specified Sesamday for # backup. If no date is specified, the current Sesamday is set. # ##################################################################### MPOOLS="'Day','Week','Month','VMs'" OUTFILE="/tmp/Used-Sesam-Media.txt" read_ini() { source `grep -i '^sm_ini=' /etc/sesam2000.ini|cut -d"=" -f2` 2>/dev/null } read_ini source "${gv_rw_ini}/sesam2000.profile" >/dev/null 2>&1 DATEVALID=0 if [ "$1" == "" ]; then # determine last Sesam day SESAMDAY=`sm_db "select max(sesam_date) from results" | tail -1 | cut -d"=" -f3 | cut -d" " -f1` DATEVALID=1 elif [[ "$1" =~ \([[:digit:]]\{4\}-[[:digit:]]\{2\}-[[:digit:]]\{2\}\) ]];then # Dateformat OK? SESAMDAY=$1 DATEVALID=1 else echo "Wrong date format !! Indicate date with pattern yyyy-mm-tt." exit 1 fi if [ $DATEVALID -ne 0 ]; then echo "Following media were used for backup on Sesamday <$SESAMDAY>:" | tee $OUTFILE sm_db "SELECT label,barcode FROM media WHERE label IN (SELECT DISTINCT label FROM result_lbls WHERE saveset IN (SELECT saveset FROM results WHERE state IN ('0','1') AND sesam_date LIKE '$SESAMDAY%' AND media_pool IN ($MPOOLS)))" | tee -a $OUTFILE sm_smtp -A "sesam" -s "SEP sesam Msg: Used media on Sesamday <$SESAMDAY>" -M "$OUTFILE" RC=$? fi if [ $RC -eq 0 ]; then echo STATUS=SUCCESS MSG="Media list was successfully created and sent by email." else echo STATUS=ERROR MSG=Error during processing fi
On Windows
This is a Powershell script. To run it, you must set permissions on the server. For details, see FAQ.
################################################# # # # Printout of used media of specific sesam day. # # With empty parameter use current sesam day. # # # ################################################# if([string] $args[0] -eq "") # Check, whether first parameter is a date { # Use current sesam day, if no parameter was specified $SESAMDAY = (sm_glbv r gv_datum) + " 00:00:00" } else { if($args[0] -match "^\d{4}\-\d{2}\-\d{2}$") # Check, whether date is in correct format { $SESAMDAY = $args[0] + " 00:00:00" } else { # Inform user of wrong date format and quit program write "Wrong date format, please use format yyyy-mm-tt" return } } # select all necessary data $RESULT = ([string] (sqlite3 -noheader "$(sm_glbv r gv_rw_db)\sesam_db.sdb" "select label from media where label IN (select distinct label from result_lbls where saveset in (select saveset from results where sesam_date='$($SESAMDAY)' and blocks>0)) order by pool,label")).Split() # In case of no result(s) if($RESULT.Length -lt 1) { sm_smtp -A sesam -s "SESAM: No media found" -m " No media found for specified sesam day $(($SESAMDAY).Replace(' 00:00:00','')). Either the date is wrong or no backup ran this date" return } # count variable $count=0 # Write text into a file temporarily Set-Content -Path $Env:TEMP\labels.txt -Value ("Following tapes were used for backups on sesam day $(($SESAMDAY).Replace(' 00:00:00','')):") # Loop to write each medium in a new line while($count -le $RESULT.Length) { if ( ($RESULT)[$count] -match "^\w{6,}" ) { Add-Content -Path $Env:TEMP\labels.txt -Value "Label: $($RESULT[$count])" } $count++; } # send mail sm_smtp -A sesam -s "SESAM: Overview of used media" -M $env:TEMP\labels.txt
Intergrating a script in SEP sesam
You can integrate a script into SEP sesam in two different ways: by creating a command event in the GUI or by using the notify interface.
By creating a command event
To integrate a script by creating a command event in the GUI, you must first create a schedule (or select an existing schedule) and then create a command event by specifying a new command.
- In the SEP sesam GUI at Main Selection-> Scheduling -> Schedules, create a new schedule or use an existing one (by double-clicking) and specify when you want the script to run (e.g., at 07:30 Monday through Friday). For step-by-step procedure, see Creating a Schedule.
- Right-click the schedule and select New Command Event.
- Click Choose next to the Name field, and than click New.
- In the New Command window, specify the following:

- In the Name field, type a descriptive name for the command, such as list_media.
- Select the client from the drop-down list.
- Specify the user name (administrator or root user).
- In the Command field, enter the following command: /opt/sesam/bin/sesam/<file> For example, on Linux: /opt/sesam/bin/sesam/List_Used_Media.sh Click OK to save the command.


![]() |
Note |
You can also start a command event immediately, under Activities -> Immediate Start -> Command. For details, see Immediate Start: Command. |
By using the notify interface
You can use the ALL_JOBS_DONE command in the notify interface to obtain information about the media used for backups on the defined backup day. Note that the notify interface must be activated before you can use it. For details, see Configuration: Interfaces.
In the following examples, the script is executed after the last scheduled event of the SEP sesam backup day has finished.
Excerpt from sm_notify (Linux):
... case $1 in ALL_JOBS_DONE) /opt/sesam/bin/sesam/list-used-labels.sh send_status_mail "$2"; # unload_tape 2; ;; INIT) ...
Excerpt from sm_notify.ps1 (Windows):
switch($command){ ALL_JOBS_DONE {$mail_subject = "Sesam backup status: $message" mail_attach $mail_subject; ./List_Used_Media.ps1; #print_attach; #unload_tape 2; #load_to_slot 1 2; break}