sep_sesam
Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Beide Seiten der vorigen RevisionVorhergehende Überarbeitung | |||
sep_sesam [2018/02/16 08:13] – matthias | sep_sesam [2018/02/16 08:33] (aktuell) – matthias | ||
---|---|---|---|
Zeile 49: | Zeile 49: | ||
* sm_disaster | * sm_disaster | ||
- | und trage immer auch den Kunden ein. Damit kann man dann für alle drei Scripte getrennte Einstellungen machen und weiss von welchem Kunden bzw. Servere die Mail kommt da das Subject dann so aussieht: "Kunde / Sesam: ...". Die angepassten Sctipte | + | und trage immer auch den Kunden ein. Damit kann man dann für alle drei Scripte getrennte Einstellungen machen und weiss von welchem Kunden bzw. Servere die Mail kommt da das Subject dann so aussieht: "Kunde / Sesam: ...". Die angepassten Sctipte |
- | ==== sm_notify ==== | ||
- | <file bash sm_notify> | ||
- | #!/bin/sh | ||
- | #$Id: sm_notify,v 1.10 2009/10/21 06:52:21 sesam Exp $ | ||
- | # | ||
- | # | ||
- | # File : sm_notify | ||
- | # Copyright : (c) SEP AG D83629 Weyarn | ||
- | # Project | ||
- | # Date : 2007-01-18 | ||
- | # | ||
- | # | ||
- | # | ||
- | # Description : Template for the SESAM notify interface. | ||
- | # It is called from SESAM after finishing a backup, media change | ||
- | # media init or SESAM day change. | ||
- | # | ||
- | # Parameters | ||
- | # ALL_JOBS_DONE, | ||
- | # $2 = message text | ||
- | # | ||
- | # | ||
- | # This is a user programable shell script with 2 parameters. | ||
- | # | ||
- | # Take care of not inserting any command waiting for an answer from | ||
- | # the user ( OK-buttons etc. ) - this may cause a complete blocking of | ||
- | # | ||
- | # | ||
- | # | ||
- | # Example | ||
- | |||
- | read_ini() | ||
- | { | ||
- | source `grep -i ' | ||
- | } | ||
- | |||
- | send_mail() | ||
- | { | ||
- | ## Set mail subject | ||
- | | ||
- | | ||
- | | ||
- | } | ||
- | |||
- | send_mail_file() | ||
- | { | ||
- | ## Set mail subject | ||
- | | ||
- | | ||
- | ## Send Sesam status file as mail body | ||
- | | ||
- | } | ||
- | |||
- | |||
- | send_status_mail() | ||
- | { | ||
- | ## Set mail subject | ||
- | | ||
- | ## Send Sesam status as mail text and protocol file as mail attachment | ||
- | | ||
- | } | ||
- | |||
- | unload_tape() | ||
- | { | ||
- | ## Unload tape from a stand alone drive. First parameter is sesam drive num | ||
- | |||
- | ## Send Sesam status as mail text and protocol file as mail attachment | ||
- | | ||
- | } | ||
- | |||
- | # | ||
- | |||
- | read_ini | ||
- | |||
- | source " | ||
- | |||
- | echo " | ||
- | |||
- | customer=`sm_db " | ||
- | GETV_PATH="/ | ||
- | GETV_FILE=" | ||
- | GETV=" | ||
- | DELAY=120 # Minuten | ||
- | |||
- | case $1 in | ||
- | ALL_JOBS_DONE) | ||
- | | ||
- | # unload_tape 2; | ||
- | ;; | ||
- | INIT) | ||
- | | ||
- | ;; | ||
- | GET_VOLUME) | ||
- | | ||
- | if [ " | ||
- | send_mail " | ||
- | echo "$1 $2" > $GETV | ||
- | else | ||
- | find $GETV_PATH -name " | ||
- | if [ $? -eq 0 ]; then | ||
- | send_mail " | ||
- | echo "$1 $2" > $GETV | ||
- | fi | ||
- | fi | ||
- | ;; | ||
- | BACKUP) | ||
- | | ||
- | ;; | ||
- | RESTORE) | ||
- | | ||
- | ;; | ||
- | BACKUP_GROUP: | ||
- | ;; | ||
- | COPY) | ||
- | ;; | ||
- | *) | ||
- | ;; | ||
- | esac | ||
- | exit | ||
- | </ | ||
- | |||
- | ==== sm_alarm ==== | ||
- | <file bash sm_alarm> | ||
- | #!/bin/sh | ||
- | # $Id: sm_alarm,v 1.6 2007/10/05 09:04:51 sesam Exp $ | ||
- | # | ||
- | # | ||
- | # File : sm_alarm | ||
- | # Copyright : (c) SEP AG D83629 Weyarn | ||
- | # Date : 2007 | ||
- | # | ||
- | # | ||
- | # | ||
- | # Description : This is the alarm interface of SESAM backup utility. | ||
- | # It is called from nearly all SESAM modules, whenever a | ||
- | # fatal error occurs. | ||
- | # | ||
- | # Parameters | ||
- | # $2 = Text of error message | ||
- | # | ||
- | # This is a user programmable shell script with 2 parameters. | ||
- | # Please insert your specific code lines after this comment. | ||
- | # Take care of not inserting commands which wait for an answer from | ||
- | # the user ( OK-buttons etc. ) - this may cause a total blocking of | ||
- | # backups during the night. | ||
- | # | ||
- | # | ||
- | # | ||
- | # Beschreibung: | ||
- | # Sie wird von fast allen Modulen im Falle eines Fehlers | ||
- | # | ||
- | # | ||
- | # Parameter | ||
- | # $2 = Text der Meldung | ||
- | # | ||
- | # Dies ist ein benutzerprogrammierbares Shell Skript mit 2 Parametern. | ||
- | # Fuegen Sie bitte Ihre eigenen Kommandozeilen nach diesem Kommentar ein, | ||
- | # wobei Kommandos, die eine Antwort erwarten ( OK-Buttons etc. ) vermieden | ||
- | # werden sollten, da sie Sicherungen waehrend der Nacht blockieren koennten. | ||
- | # | ||
- | # | ||
- | # | ||
- | # Example | ||
- | # | ||
- | read_ini() | ||
- | { | ||
- | | ||
- | } | ||
- | # | ||
- | send_mail() | ||
- | { | ||
- | ## Set mail subject | ||
- | | ||
- | ## Send Sesam status file as mail body | ||
- | | ||
- | } | ||
- | # | ||
- | send_backup_mail() | ||
- | { | ||
- | ## Set mail subject | ||
- | | ||
- | ## Send Sesam not file as mail body | ||
- | f=$( echo $2|cut -d ':' | ||
- | echo $f | ||
- | | ||
- | } | ||
- | |||
- | # | ||
- | read_ini | ||
- | source " | ||
- | echo " | ||
- | customer=`sm_db " | ||
- | |||
- | GETV_PATH="/ | ||
- | GETV_FILE=" | ||
- | GETV=" | ||
- | DELAY=120 # Minuten | ||
- | |||
- | case $1 in | ||
- | INIT) | ||
- | | ||
- | ;; | ||
- | | ||
- | | ||
- | if [ " | ||
- | | ||
- | echo "$1 $2" > $GETV | ||
- | else | ||
- | find $GETV_PATH -name " | ||
- | if [ $? -eq 0 ]; then | ||
- | send_mail " | ||
- | echo "$1 $2" > $GETV | ||
- | fi | ||
- | fi | ||
- | ;; | ||
- | | ||
- | | ||
- | ;; | ||
- | | ||
- | | ||
- | ;; | ||
- | *) | ||
- | | ||
- | ;; | ||
- | esac | ||
- | exit | ||
- | </ | ||
- | |||
- | ==== sm_disaster ==== | ||
- | <file bash sm_disaster> | ||
- | #!/bin/sh | ||
- | # $Id: sm_disaster, | ||
- | # ****************************************************************************** | ||
- | # | ||
- | # | ||
- | # | ||
- | # | ||
- | # | ||
- | # | ||
- | # ****************************************************************************** | ||
- | # | ||
- | # >>> | ||
- | # | ||
- | # >>> | ||
- | # | ||
- | # ****************************************************************************** | ||
- | # | ||
- | # Description : | ||
- | # This procedure is called from a SESAM backup if job name contains string | ||
- | # " | ||
- | # | ||
- | # These backups should be designed to save files, which are needed to recover | ||
- | # the SESAM server itself - called disaster recovery. | ||
- | # These are the .\sesam\... directory and the LIS-directory, | ||
- | # under .\sesam\.. | ||
- | # Furtheron the files of the database. | ||
- | # | ||
- | # SESAM sends the media label and the barcode of the used media and | ||
- | # a valid restore command to this procedure. | ||
- | # Starting this command, the file of the currently running backup will be | ||
- | # copied back to their original places. | ||
- | # | ||
- | # It is urgently recommended to sent it to several different locations to | ||
- | # keep them available in case of full crash of the SESAM server itself. | ||
- | # | ||
- | # For example write them to files on other computers within your net, | ||
- | # mail them etc. . | ||
- | # | ||
- | # The values are as follows: | ||
- | # | ||
- | # $1 = {label} {backup source} {barcode} | ||
- | # $2 = {sbc restore command} | ||
- | # | ||
- | # There is already an example configured below. This works if in Sesam GUI | ||
- | # in menu line " | ||
- | # had been added. | ||
- | # | ||
- | # It is easy to do user specified adaptations !!! | ||
- | # | ||
- | # ****************************************************************************** | ||
- | # | ||
- | # Beschreibung | ||
- | # Wird vom SESAM waehrend einer Sicherung gerufen, deren Name " | ||
- | # oder " | ||
- | # | ||
- | # Diese Sicherungen sollten Verzeichnisse kopieren, die fuer die Wieder- | ||
- | # herstellung des SESAM Servers selbst noetig sind, dem sogenannten | ||
- | # Disaster Recovery. | ||
- | # | ||
- | # Dieses sind das .\sesam\... Verzeichnis, | ||
- | # sie nicht unter .\sesam liegen. | ||
- | # Desweiteren die Dateien der SESAM Datenbank. | ||
- | # | ||
- | # SESAM sendet den Medienlabel und ggf. den Barcode des benutzten Mediums | ||
- | # und ein vollstaendiges Restaurierungskommando an diese Prozedur. | ||
- | # Startet man diese Prozedur von der Komandozeile, | ||
- | # der gelaufenen Sicherung wieder an ihre urspruenglichen Plaetze zurueckkopiert. | ||
- | # | ||
- | # Es wird dringendst empfohlen diese Werte in Dateien, Mails etc. auf mehrere | ||
- | # andere Rechner in ihrem Netz zu verlagern, um sie im Falle eines | ||
- | # Systemausfalls des SESAM Servers verfuegbar zu haben. | ||
- | # | ||
- | # Die Werte sind die folgenden: | ||
- | # | ||
- | # $1 = {label} {backup source} {barcode} | ||
- | # $2 = {sbc restore command} | ||
- | # | ||
- | # Unten ist bereits ein Beispiel eingerichtet, | ||
- | # Sesam GUI im Menue unter " | ||
- | # der Account " | ||
- | # | ||
- | # User-spezische Anpassungen sind damit leicht durchfuehrbar !!! | ||
- | # | ||
- | # ****************************************************************************** | ||
- | # | ||
- | # Example / Beispiel | ||
- | # | ||
- | read_ini() | ||
- | { | ||
- | source `grep -i ' | ||
- | } | ||
- | read_ini | ||
- | source ${gv_rw_ini}/ | ||
- | customer=`sm_db " | ||
- | echo "SEP sesam Desaster Information to restore SEP sesam system after data loss" > ${gv_rw_work}/ | ||
- | echo "Media Source and if exisiting Barcode" | ||
- | echo $1 >> ${gv_rw_work}/ | ||
- | echo " | ||
- | echo $2 >> ${gv_rw_work}/ | ||
- | # | ||
- | # remote copy disaster.tmp to other node via Linux mail: | ||
- | # echo " | ||
- | # OR via SMTP interface with configured email account " | ||
- | sm_smtp -A " | ||
- | </ | ||
- | |||
- | ===== Anpassungen für INIT-Scripte (Debian) ===== | ||
- | An den Anfang eines jeden Scripts gehört das hier: | ||
- | |||
- | <code bash> | ||
- | if [ ! -f / | ||
- | echo " | ||
- | exit 1 | ||
- | fi | ||
- | </ | ||
- | |||
- | Um sicher zu stellen dass das Script nur ausgeführt wrid, wenn die Ini auch existiert. | ||
- | |||
- | Es sieht such aus als wäre das Init-Script von einem Suse/Red Har Script abgeleitet. Dort gibt es nämlich eine Init-Funktionssammlung die eine Funktione " | ||
- | |||
- | ... | rc_failed | ||
- | |||
- | Und im Debian-Initecritp: | ||
- | |||
- | ... | exit $rc_failed | ||
- | |||
- | Das hat zur Folge, das man nie weiss wenn man das Init-Script benutzt ob der Auftruf nun erfolgreich war oder nicht. | ||
- | |||
- | Um das zu zu korrigieren füge ich dem Script die Funktion " | ||
- | |||
- | <code bash> | ||
- | function rc_failed () | ||
- | { | ||
- | echo " FAILED" | ||
- | exit $rc_failed | ||
- | } | ||
- | </ | ||
- | |||
- | und ändere alle Zeilen die so ausehen: | ||
- | |||
- | <code bash> | ||
- | ${GV_RO_BIN}/ | ||
- | </ | ||
- | |||
- | in das hier: | ||
- | |||
- | <code bash> | ||
- | ${GV_RO_BIN}/ | ||
- | </ | ||
- | |||
- | Nach noch ein paar anderen Schönheitsoperationen sieht das dann so aus: | ||
- | |||
- | <file bash sesam> | ||
- | #!/bin/sh | ||
- | # $Id: sm_startstop.linux, | ||
- | # Copyright (c) 2002 | ||
- | # | ||
- | # Authors: Rainer Seyerlein < | ||
- | # | ||
- | # | ||
- | # | ||
- | # / | ||
- | # | ||
- | ### BEGIN INIT INFO | ||
- | # Provides: | ||
- | # Required-Start: | ||
- | # X-UnitedLinux-Should-Start: | ||
- | # Required-Stop: | ||
- | # X-UnitedLinux-Should-Stop: | ||
- | # Default-Start: | ||
- | # Default-Stop: | ||
- | # Short-Description: | ||
- | # Description: | ||
- | ### END INIT INFO | ||
- | |||
- | |||
- | # | ||
- | # load the configuration | ||
- | # | ||
- | read_ini() | ||
- | { | ||
- | | ||
- | echo `grep -i " | ||
- | } | ||
- | |||
- | if test -r / | ||
- | then | ||
- | GV_RO=`read_ini gv_ro` | ||
- | else | ||
- | GV_RO=/ | ||
- | fi | ||
- | . ${GV_RO}/ | ||
- | |||
- | test -s / | ||
- | . / | ||
- | |||
- | rc_failed() | ||
- | { | ||
- | echo " FAILED" | ||
- | exit 3 | ||
- | } | ||
- | |||
- | |||
- | ### Linux | ||
- | case " | ||
- | start) | ||
- | echo -n " | ||
- | | ||
- | | ||
- | case $ret in | ||
- | 0) | ||
- | ${GV_RO_BIN}/ | ||
- | ;; | ||
- | 1) | ||
- | echo "" | ||
- | echo "Found new sesam version. Starting update ... " | ||
- | if [ " | ||
- | | ||
- | else | ||
- | | ||
- | | ||
- | fi | ||
- | ;; | ||
- | 2) | ||
- | echo "" | ||
- | echo "Sesam not configured yet. Starting setup ... " | ||
- | setup | ||
- | ;; | ||
- | esac | ||
- | ;; | ||
- | stop) | ||
- | echo -n " | ||
- | if [ " | ||
- | then | ||
- | | ||
- | else | ||
- | | ||
- | fi | ||
- | ;; | ||
- | status) | ||
- | echo -n " | ||
- | | ||
- | exit $? | ||
- | ;; | ||
- | reload) | ||
- | $0 stop && | ||
- | ;; | ||
- | restart) | ||
- | $0 stop && | ||
- | ;; | ||
- | *) | ||
- | echo " | ||
- | exit 1 | ||
- | ;; | ||
- | esac | ||
- | |||
- | echo " OK" | ||
- | exit 0 | ||
- | |||
- | # Inform the caller not only verbosely and set an exit status. | ||
- | </ | ||
- | |||
- | ===== Kerio LVM-Backup ===== | ||
- | ==== sbc_pre ==== | ||
- | <file code sbc_pre> | ||
- | #!/bin/bash | ||
- | # $Id: sbc_pre,v 1.4 2003/09/22 11:18:16 psl Exp $ | ||
- | # | ||
- | # | ||
- | # SESAM PRE procedure for UNIX clients | ||
- | # | ||
- | # | ||
- | # | ||
- | # Description: | ||
- | # it gives the user a possibility to do some special things before | ||
- | # backup ( prepare databases, send messages etc. ). | ||
- | # | ||
- | # It is called with 10 parameters from the current SESAM backup: | ||
- | # | ||
- | # $1 = Backup source | ||
- | # $2 = Tape server interface | ||
- | # $3 = SESAM task name | ||
- | # $4 = Number of SESAM drive | ||
- | # $5 = Type of backup C_opy, F_ull, D_ifferential, | ||
- | # $6 = Execution counter ( = number of LIS-file ) | ||
- | # $7 = Saveset ID | ||
- | # $8 = Label of used media | ||
- | # $9 = Name of mediapool | ||
- | # 10 = Schedule | ||
- | # | ||
- | # | ||
- | # if this procedure ran OK | ||
- | # then echo " | ||
- | # else echo " | ||
- | # | ||
- | # >>> | ||
- | # | ||
- | # | ||
- | |||
- | #=== Print call arguments ===================================== | ||
- | source=$1 | ||
- | tape_server=$2 | ||
- | task=$3 | ||
- | drive_number=$4 | ||
- | backup_type=$5 | ||
- | exe_cnt=$6 | ||
- | saveset=$7 | ||
- | label=$8 | ||
- | pool=$9 | ||
- | shift | ||
- | schedule=$9 | ||
- | |||
- | echo source | ||
- | echo tape_server | ||
- | echo task = $task | ||
- | echo drive_number = $drive_number | ||
- | echo backup_type | ||
- | echo exe_cnt | ||
- | echo saveset | ||
- | echo label = $label | ||
- | echo pool = $pool | ||
- | echo schedule | ||
- | |||
- | #=== Please insert your specific actions here===================================== | ||
- | |||
- | #echo STATUS: | ||
- | |||
- | case " | ||
- | kerio) | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | ;; | ||
- | esac | ||
- | |||
- | echo STATUS:OK | ||
- | </ | ||
- | ==== sbc_post ==== | ||
- | <file code sbc_post> | ||
- | #!/bin/sh | ||
- | # $Id: sbc_post,v 1.4 2003/09/22 11:37:44 psl Exp $ | ||
- | # | ||
- | # | ||
- | # SESAM POST procedure for UNIX clients | ||
- | # | ||
- | # | ||
- | # | ||
- | # Description: | ||
- | # it gives the user a possibility to do some special things after | ||
- | # backup ( restart databases, send messages etc. ). | ||
- | # | ||
- | # It is called with 12 parameters from the current SESAM backup: | ||
- | # | ||
- | # $1 = Backup source | ||
- | # $2 = Tape server interface | ||
- | # $3 = SESAM task name | ||
- | # $4 = Number of SESAM drive | ||
- | # $5 = Type of backup C_opy, F_ull, D_ifferential, | ||
- | # $6 = Status of backup ( 1 = ok, 0 = error ) | ||
- | # $7 = Message text from backup | ||
- | # $8 = Execution counter ( = number of LIS-file ) | ||
- | # $9 = Saveset ID | ||
- | # 10 = Label of used media | ||
- | # 11 = Name of mediapool | ||
- | # 12 = Schedule | ||
- | # | ||
- | # | ||
- | # if this procedure ran OK | ||
- | # then echo " | ||
- | # else echo " | ||
- | # | ||
- | # >>> | ||
- | # | ||
- | # | ||
- | # | ||
- | |||
- | |||
- | #=== Print call arguments ===================================== | ||
- | |||
- | source=$1 | ||
- | tape_server=$2 | ||
- | task=$3 | ||
- | drive_number=$4 | ||
- | backup_type=$5 | ||
- | backup_status=$6 | ||
- | backup_message=$7 | ||
- | exe_cnt=$8 | ||
- | saveset=$9 | ||
- | shift | ||
- | label=$9 | ||
- | shift | ||
- | pool=$9 | ||
- | shift | ||
- | schedule=$9 | ||
- | |||
- | echo source | ||
- | echo tape_server | ||
- | echo task = $task | ||
- | echo drive_number | ||
- | echo backup_type | ||
- | echo exe_cnt | ||
- | echo saveset | ||
- | echo label = $label | ||
- | echo pool = $pool | ||
- | echo schedule | ||
- | echo backup_status | ||
- | echo backup_message = $backup_message | ||
- | |||
- | |||
- | #=== Please insert your specific actions here ===================================== | ||
- | |||
- | #echo STATUS: | ||
- | case " | ||
- | kerio) | ||
- | / | ||
- | / | ||
- | ;; | ||
- | esac | ||
- | |||
- | |||
- | echo STATUS:OK | ||
- | </ | ||
sep_sesam.1518768809.txt.gz · Zuletzt geändert: 2018/02/16 08:13 von matthias