SEP Sesam CLI

From SEPsesam

Jump to: navigation, search

(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

Introduction

The SEP sesam command line interface (SEP sesam CLI) is used to install and configure a SEP sesam environment automatically with any GUI. This CLI is integrated in the SEP sesam server from version 3.6 and higher. Every CLI command (except a native SQL statement) checks and follows the internal structure and dependencies of the SEP sesam database.

Features:

  • Automatic configuration of SEP sesam environments after installation (e.g. on implementation)
  • Change the SEP sesam configuration without using the SEP sesam GUI
  • Script-based mass installation and configuration (e.g. provider environment)
  • Operate tests for installation and configuration in SEP sesam environments


Attention: Recommendations for using the SEP sesam Command Line Interface (CLI)

When using the optional Command Line features of SEP sesam commands are written directly to the SEP sesam database.

The commands are immediately acted upon by SEP sesam once the <Enter> key is pressed. Therefore, there is no chance to correct or change an entry, which is possible when using the SEP sesam GUI.

For this reason it is extremely important to follow a specific and defined plan when using the command line to prevent a user caused system failure in the backup environment. Such a mistake is not to be underestimated – a wrong or mistaken entry can lead to complete data loss or other damage to the database.

Unchecked or unverified command line entries should be avoided!

Such mistakes can void the warranty offered by your SEP sesam licensing agreement.

Before you start with scripting with the SEP sesam CLI you should acquire basic knowledge about the SEP sesam environment. First study the User Guide and the Administrator guide and work with a SEP sesam installation to get experience how the SEP sesam objects work together. Alternatively, use the seminar offers from SEP AG to learn the main structure of the functions and configuration of the SEP sesam. After that you're ready to start working with the SEP sesam CLI and write your first scripts.

CLI example

CLI example

Before you start reading the syntax description it could be helpful to have a look at a small SEP sesam CLI example for creation of a new SEP sesam environment by SEP sesam CLI.




Using the SEP sesam Command Line Interface

The following chapter describes the use of the object items of the SEP sesam CLI. There are mandatory and optional options. Mandatory options are designated by an asterisk (*). At the end of each object section there are one or more examples on how to use the command.

When building a new SEP sesam environment using the CLI, work in the same order as you would when using the SEP sesam GUI. Start with the Topology objects, then create tasks, schedules and finally connect the according events (e.g. backup, migration or command) to the schedules.


Attention: Global Deletion

With "Global Deletion" it's possible to delete a client or task with all dependent or related objects. That means if you want to delete a client you can delete all of its appropriate tasks at the same time. For example, if you delete a task during this process it will be removed from its task groups and task events. "Global Deletion" is available for client and task. You can enforce that by using the parameter -F YES. The string YES is for security. It verifies that the user actually wants to perform this task.

If a backup client is connected to a loader or drive it cannot be deleted by the parameter Force. First remove the loader or drive and then re-start the client/task deletion.


Syntaxes

CLI main call

Usage:

sm_cmd <parameters> <command> <object> <options>

Parameters:

   -v <loglevel>       Loglevel
   -S <Sesam Server>   SEP sesam Server to connect to

Commands:

     add
     modify
     remove
     help
     list
     start

Commands for drive only:

     mount
     dismount
     unload

Commands for loader only:

     import
     export
     unload
     load

Objects:

     client
     task
     taskgroup
     schedule
     location
     taskEvent
     taskGroupRelation
     backup
     migration
     migrationtask
     restoretask
     restore
     command
     commandevent
     inventory
     media
     mediapool
     drivegroup
     drive
     loader
     interface
     mailer/account

Example:

sm_cmd -v 2 add task barometrix_etc -c barometrix.sep.de -s /etc

Output:

2009-08-17 16:36:53 INFO  - Sesam GUI V3.6 Build 1 A 1.5511   2009-08-17 08:23:24
2009-08-17 16:36:53 INFO  - set level to 'INFO'
2009-08-17 16:36:53 INFO  - logging to console started.
2009-08-17 16:36:53 INFO  - Server set to smsrv
2009-08-17 16:36:53 INFO  - set port to '11401'
2009-08-17 16:36:53 INFO  - set loglevel: 2
2009-08-17 16:36:53 INFO  - CLI: CliService is available
2009-08-17 16:36:53 INFO  - sm_gui_request"test.jvr"null"S"sm_setup"get_policy "
2009-08-17 16:36:53 INFO  - SesamRemoteShell.callRemoteShell(0) commandString='sm_gui_request"test.jvr"null"S"sm_setup"get_policy "'
2009-08-17 16:36:53 INFO  - Authentificate User 'root'
2009-08-17 16:36:53 INFO  - CLI: -S smsrv -p 11401 -v 2 add task MucEsc01_etc -c MucEsx01 -s /etc
2009-08-17 16:36:53 INFO  - DB SQL: 'SELECT * FROM clients WHERE name='MucEsx01
2009-08-17 16:36:53 EXEC  - DB SQL: 'INSERT INTO tasks (backup_type, client_id, source, prepost, r_prepost, crypt_flag, task)  VALUES ('Path','2','/etc','nnnn','nnnn','0','MucEsc01_etc')'
STATUS=SUCCESS MSG="MucEsc01_etc"

All INFO messages are written to standard error. They can suppressed by redirecting stderr to /dev/null.




Displaying SEP sesam DB data

The content of the SEP sesam DB concerning several actions can be displayed with the parameter list or sql.

Options:

  • -d: Delimiter \t = TAB (default)
  • -F: Output format (default: header)

Examples:

The delimiter parameter is only valid with specific formats. Some usage examples follow:

  • Output with column delimiter "|" (pipe) with different header

Command:

sm_cmd list locations -d "|"
sm_cmd sql "select * from locations" -d "|"

Output:

id|name|parent|describe|contact|comment
0|LOCAL|NULL|NULL|NULL|NULL

Command:

sm_cmd list locations -d "|" -F noheader
sm_cmd sql "select * from locations" -d "|" -F noheader

Output:

0|LOCAL|NULL|NULL|NULL|NULL

Command:

sm_cmd list locations -d "|" -F named
sm_cmd sql "select * from locations" -d "|" -F named

Output:

id=0|name=LOCAL|parent=NULL|describe=NULL|contact=NULL|comment=NULL|originalid=0|insert=false|update=false|delete=false

Here are some examples for the different format (-F) values:

  • Standard display without format parameter

Command:

sm_cmd list locations 
sm_cmd sql "select * from locations"

Output:

id	name	parent	describe	contact	comment
0	LOCAL	NULL	NULL	NULL	NULL
  • Hide the column header

Command:

sm_cmd list locations -F noheader
sm_cmd sql "select * from locations" -F noheader

Output:

0	LOCAL	NULL	NULL	NULL	NULL
  • Display the column header in a special form (header=value)

Command:

sm_cmd list locations -F named
sm_cmd sql "select * from locations" -F named

Output:

id=0	name=LOCAL	parent=NULL	describe=NULL	contact=NULL	comment=NULL	originalid=0	insert=false	update=false	delete=false
  • Output the data as SQL DML command (insert)

Command:

sm_cmd list locations -F export
sm_cmd sql "select * from locations" -F export

Output:

INSERT INTO locations (id,name,parent,describe,contact,comment) VALUES (0,'LOCAL',NULL,NULL,NULL,NULL)

You can use this output to create datasets manually, e.g.

sm_db "INSERT INTO locations (id,name,parent,describe,contact,comment) VALUES (0,'LOCAL',NULL,NULL,NULL,NULL)"


Topology

Location

After the installation of a new SEP sesam server a standard location - named Local - is created. You can use this default location to add your clients or create your own locations as desired.

Usage:

sm_cmd <add|modify|remove> location <ID>|auto [OPTIONS...]

If 'ID' is set to 'auto' SEP sesam will generate it automatically.

Options:

  -L   locationName *
  -p   parent   (reference existing Location)
  -i   describe
  -c   contract
  -j   comment

Example:

sm_cmd add location 3 -L MUNICH
sm_cmd add location auto -L SEP -p MUNICH -j "Headquarter"
sm_cmd remove location 3

Client

Right after the installation of a new SEP sesam Server the SEP sesam server client object already exists. You have to register your backup clients in the SEP sesam environment before you can use them. If you add clients with the SEP sesam GUI during the registration process the SEP sesam Server checks if the client is visible/reachable to him. This is different with the SEP sesam CLI and therefore it's recommended to check the client availability by starting a small backup task after adding it (client).

Usage:

sm_cmd <add|modify|remove> client <hostname>* [OPTIONS...]

Options:

  -L   location (default: 0)
  -o   <OS> *  (reference oper_systems)
  -a   accessmode <CTRL|SSH|RSH>
  -i   user comment
  -y   permit  <y|n>
  -O   access options 
  -r   stpd options
  -p   stpd port 
  -F   <YES> remove all objects belonging to client too


Attention: Global Deletion

If an object is removed by using the "-F YES" option all other objects (e.g. tasks) that depend on it are removed as well.


For backup clients in a Novell environment the following options are necessary to work properly.

Options for 'NetWare':

  -d   data_mover *
  -U   user_name *
  -P   password *

Example:

sm_cmd add client barometrix -o LINUX
sm_cmd add client minus -o "Windows XP" -a CTRL -L 33
sm_cmd modify client beifus -i "new comment" -o "LINUX"
sm_cmd remove client minus -f YES

Interface

The configuration of the interface is only necessary if you want to use LAN-free backup or a SAN environment. Your backup server has to have at least two network interface modules. They have to be configured with different IP addresses and DNS names. You can then create an interface for every network interface you'd like to use. For more information see the SEP sesam Admin Guide.

Usage:

sm_cmd <add|modify|remove> interface <interface name> [OPTIONS...]

Options:

  -c   clientname *

Example:

sm_cmd add interface buildfix -c buildfix.sep.de
sm_cmd remove interface buildfix 

Tape Library (Loader)

This section will instruct you on how to configure your loader hardware.


Attention: Using loader slots

You cannot use export or mail slots for backup. You can move media between them but backup jobs will only work with normal slots in the library.


Usage:

sm_cmd <add|modify> loader <loader number> [OPTIONS...]

Options (add|modify|remove)

  -N   loader name
  -d   device *
  -S   remote device server  (reference clients)
  -t   type *
  -s   number of slots *  <[0-9]{5}>
  -b   barcode flag  <0|1> (default: 0)
  -a   autounload flag <0|1> (default: 0)
sm_cmd <load|unload|import|export> loader <loader number> [OPTIONS...]

Options (load,unload,import|export):

  • load: move a tape from a slot (-s) the a drive (-d)
  • unload: move a tape from a drive (-d) to a slot (-s)
  • import: move a tape from an export or mail slot (-p) to a drive (-d)
  • export: move a tape from a drive (-d) to an export or mail slot (-p)

Options (import|export):

  -p   port
  -s   slot or label

Options (load|unload):

  -d   drive number
  -s   slot

Example:

sm_cmd add loader auto -d /dev/sg1 -t LTO -s 254 -b y -a n
sm_cmd load loader 1 -s 50 -d 1
sm_cmd import loader 2 -p 2 -s 52

Loader Device

Here you configure your loader devices.


Attention: Add loader device

The loader number of the loader device must exist in hwloaders.


Usage:

sm_cmd <add|modify|remove|list|help> loaderdevice <loader number> (reference hw_loaders.loader_num)[OPTIONS...]

Options (add|modify|remove)

  -s   slot <[0-9]*> *
  -d   device path *

Example:

sm_cmd add loaderdevice 0 -s 11 -d "c:\loaders\devices"
sm_cmd modify loaderdevice 0 -s 50
sm_cmd remove loaderdevice 0

Drive group

Every drive must be a member of a drive group. Therefore, drive group has to be created before adding a drive.

Usage:

sm_cmd <add|modify|remove> drivegroup <drivegroup name> [OPTIONS...]

Options:

  -i   comment

Example:

sm_cmd add drivegroup Tapedrives -i "LTO Drives"

Drive

After creating drive groups you can add your drive to the desired drive group. After adding or modifying a drive SEP sesam immediately creates the internal drive structures. This will cause an interruption of all running backups. To avoid this, you can use the parameter -o noconfig. The drive configuration will only be written into the SEP sesam database. To use the drive for SEP sesam operation you must first execute the sm_config_drives command manually.

Usage:

sm_cmd <add|modify|remove|mount|dismount|unload> drive <drive number> [OPTIONS...]

Options:

  -l   loader number (* if -L is set, reference hw_loaders)
  -L   loader drive (* if -l is set)
  -t   typ *  (reference drive_types)
  -S   remote device server *
  -G   drivegroup name (* -G or -g)
  -g   drivegroup id (* -G or -g)
  -d   device *
  -N   drive name
  -n   SMS channels
  -o   doesn't call sm_drive_config and writes only in the db. Parameter must be set with the argument "noconfig"

Options for Action REMOVE:

  -o   doesn't call sm_config_drives and removes it only from db. Parameter must be set with the argument "noconfig"

Example:

sm_cmd add drive auto -t DLT -d /dev/nst0 -S beifus -G diskdrives -o noconfig
sm_cmd modify drive 3 -d /dev/nst1
sm_cmd mount drive 3

Mediapool

The number of necessary mediapools depends on your planned backup and media strategy.

Usage:

sm_cmd <add|modify|remove> mediapool <mediapool name> [OPTIONS...]

Options:

  -G   drive group by name *  (references drive_groups)
  -e   eol by days *  <[0-9]{5}>
  -i   description
  -n   disk capacity in MB (only for DISK_HARD)
  -D   disk directory (only for DISK_HARD)

Example:

sm_cmd add mediapool LARGEDISK -G LargeDrives -e 5 -n 10000 -D /srv/SESAMPOOL/LARGE

Media

Usage:

sm_cmd <add|modifiy|remove> media <tape label|'auto'> [OPTIONS...]

Options (add):

  -i   action <over|take> (default: take)
  -o   option <check|noncheck|recover> (default: check)
  -t   label
  -T   media type
  -b   barcode
  -c   format
  -d   drive number *
  -m   media pool (* if tape label is 'auto', reference media_pools)
  -L   mediapool location
  -s   saveset

Options (modify):

  -e   eol
  -l   loader number
  -s   slot  
  -i   comment
  -k   '+' for unlock, '-' for lock media

Example:

sm_cmd add media -d 3 -m LARGEDISK -T DISK_1000
sm_cmd add media -d 1 -i check -m SINGLE -T THXKD
sm_cmd modify media SINGLE00001 -k - -i "Important data"
sm_cmd modify Media DISK00006 -e "2009-08-19 09:00:00"
sm_cmd remove media LARGEDISK00001       (only possible, if drive/eol is not active)

Inventory

Usage:

sm_cmd <start> inventory <loader number> [OPTIONS...]

Options:

  -d   drivenumber  (* if -G or -d is set)
  -i   <action>  no|take|overwrite  
                 SEP sesam media which are not in archive (default: no)
         no       : do not introduce any media
         take     : check if media exist and are valid. if not introduce them
         overwrite: same as take, but reinitialize existing media
  -m   mediapool  (* -i is set)
  -t   volume type  Adequate type for selected media_pool  (* -i is set)
  -s   slot_area  <[0-9]{1,3}-[0-9]{1,3}>
                  Slot area, when not given all slots are handled
                  the syntax for this parameter is n-m, e.g. 2-9
                  first valid slot number is 0
  -c   Check label flag, when set the label on tape is always checked,
       don't rely on the barcode information only
  -f   Fast mode, when set the label is read without retry in case of failure.
       Use this switch together with the introduce switch only when you are
       sure that your call may actually introduce new media.
  -L   Storage pool location for DISK_HARD media
       don't rely on the barcode information only
  -G   smDriveGroup  (* if -G or -d is set)

Example:

sm_cmd start inventory 0 -d 3 -i take -m LARGEDISK -t DISK_1000 -s 0-4
sm_cmd start inventory 2 -d 3 -i take -m DAYPOOL -t LTO_Tape -s 2-7 -c


Tasks

Task

Usage:

sm_cmd <add|modify|remove> task <task name> [OPTIONS...]
sm_cmd <start> task <task name> [OPTIONS...]

Options (add|modify):

  -t   backup_type
  -c   client_name * (-c or -I)
  -I   client_id * (-c or -I)
  -s   source * 
  -x   exclude
  -i   comment
  -o   backup_options
  -r   restore_options
  -P   prepost  <[ny]{4}>  ('ynyn', 'nnyy', 'ynny')
              (1. <y|n> activate pre interface
               2. <y|n> execute backup despite pre error
               3. <y|n> activate post interface
               4. <y|n> execute post despite backup error)
  -R   r_prepost  <[y|n]{4}>  (see under prepost)
  -N   nfs_mount  <[y|n]>
  -f   filesystem <[y|n]>
  -b   bsr_flag  <[0|1]>
  -C   compress_flag  <[0|1]>
  -E   crypt_flag  <[0|a|b]>
              (1. <0> no crypt
               2. <a> AES256
               3. <b> blowfish64)
  -k   crypt_key
  -F   <YES> remove task completely from all depending tables

Example:

sm_cmd add task minus_ini -c minus -s C:/programme/sepsesam/var/ini
sm_cmd modify task minus_ini -i "modified task"
sm_cmd remove task minus_ini

Options (start):

  -m   media pool (*)  (reference media_pools)
  -d   drive number  (reference hw_drives)
  -l   backup level <[CFDI]>. Default: COPY
              (1. <C> Copy
               2. <F> Full
               3. <D> Diff
               4. <I> Inc
  -a   online mode <online|offline>
  -S   backup interface  (reference interfaces)
  -T   start time  <yyyy-mm-dd hh:mm:ss>

Example:

sm_cmd start task minus_ini -m DISK -l D

Taskgroup

Usage:

sm_cmd <add|modify|remove> taskgroup <taskgroup name> [OPTIONS...]

Options:

  -i   comment
  -P   prepost  <[ny]{4}>  ('ynyn', 'nnyy', 'ynny')
             (1. <y|n> activate pre interface
              2. <y|n> execute backup despite pre error
              3. <y|n> activate post interface
              4. <y|n> execute post despite backup error)

Example:

sm_cmd add taskgroup all_systemstate -i "System state of all Windows hosts"

Taskgroup relation

You can combine several tasks to task groups.

Usage:

sm_cmd <add|modify|remove> taskgrouprelation <taskgroup name> [OPTIONS...]

Options:

  -j   task *  (reference tasks)
  -n   start order  <[0-9]{5}>

Example:

sm_cmd add taskgrouprelation all_systemstate -j winfix_system -n 1

Migration task

Usage:

sm_cmd <add|modify> migrationtask <migrationtask name> [OPTIONS...]

Options:

  -m   source pool *  (reference media_pools)
  -M   target pool *  (reference media_pools)
  -d   source drive *  (reference hw_drives)
  -D   target drive *  (reference hw_drives)
  -S   interface  (reference interfaces)
  -n   saveset copy count (default:0 = unlimited)

Filter options:

  -l   backup levels <default:CFDI>
  -e   backup state  (0 = only successful
                      1 = successful or with warnings
                      3 = partially restorable)
  -B   date start    (absolute i.e. "2009-08-14"
                      relative i.e. "-3")
  -E   date end      (absolute i.e. "2009-08-17"
                      relative i.e. "0")
  -i   comment

Just one of the following 4 filter options can be set.

  -j   task  (reference tasks)
  -G   taskgroup  (reference taskgroups)
  -s   saveset
  -c   client (reference clients)

Example:

sm_cmd add migrationtask DISK2TAPE -m DISK -M TAPE -d 1 -D 2

Restore task

Usage:

sm_cmd <add|modifiy|remove> restoretask <restoretask name|auto> [OPTIONS...]

Options:

  -s   saveset *  (reference results, result.state = [0-3], result.fdi_typ = [CFDI], )
  -l   rest typ
  -G   generation restore <0|1>
  -t   treetyp <d|f>
       ( <d>    deep
         <f>    flat )
  -O   mode  <[nov]>
       ( <n>    non overwrite
         <o>    overwrite
         <v>    new version )
  -c   client  (reference clients)
  -R   target *
  -d   drive num
  -S   iname
  -F   filter
  -P   r_prepost (nnnn)
  -o   options
  -i   comment
  -D   date (YYYYMMDD | YYYY-MM-DD)
  -j   task
  -n   cnt
  -f   sel File

Example:

sm_cmd add restoretask r_task01 -j SESAM_BACKUP -R \"c:\\tmp\" -f \"c:SaveTest\\seltest.sel\"
sm_cmd add restoretask r_task01 -s SF20090225121007 -R \"c:\\tmp\" -f \"c:SaveTest\\seltest.sel\"
sm_cmd add restoretask r_testfile -s SF20091026161007 -R /tmp -f /var/log/messages

Command task

Usage:

sm_cmd <add|modify|remove> command <command name> [OPTIONS...]
sm_cmd <start> <command name> [OPTIONS...]

Options:

  -c   client (* reference clients)
  -u   user name *
  -C   command *

Example:

sm_cmd add command unload_drive -c sesamx -u root -C /opt/sesam/bin/sesam/sm_loader unload

Restart Task

Usage:

sm_cmd <restart> [OPTIONS...]
sm_cmd <list|help> restart

Options:

  -d   sesam date <yyyy-MM-DD> * (mandatory, if saveset not set)
  -s   saveset <saveset1,saveset2,...> * (mandatory, if sesam date not set)
  -S   start time 

Parameter '-s' (saveset) can contain several savesets divided by comma

Example:

  sm_cmd restart -d 2010-09-03 -S "07.09.2010 15:04:16"
  sm_cmd restart -s SI20100901132603842
  sm_cmd restart -s SI20100901132603842,SI20100901132604050,SI20100902132605597
  sm_cmd list restart -d | -F named


Schedules & Events

Schedule

If you want to execute your backups on a specific time table you have to create tasks first. Then you must create a schedule and add the task and the schedule to a backup event. There are different event types to connect to a schedule (see below).

Usage:

sm_cmd <add|modify|remove> schedule <schedule name> [OPTIONS...]

Options:

  -l   cycle flag  <0|1>  (default: 1 )
  -a   absolut flag  <0|1>
  -d   week days  <mo|tu|we|th|fr|sa|su>
  -T   cycle  <MIN|HOU|DAY|WEE|MON|YEA>
  -D   day of mth  <1-31>
  -M   mth of yea  <1-12>
  -W   wk of mth  <1-4>
  -O   day of wk  <1-7>
  -S   startDate  <yyyy-mm-dd hh:mm:ss>
  -E   endDate  <yyyy-mm-dd hh:mm:ss>
  -x   exec  <[01]>
  -s   start time  <hh:mm>
  -w   duration  <hh:mm>
  -o   day offset  <0-99>
  -i   comment

Example:

sm_cmd add schedule cli-test-daily -T DAY -s 12:20
sm_cmd add schedule cli-test-week -T WEE -s 12:20 -d sa,su
sm_cmd add schedule cli-test-month -T MON -s 12:20 -D 21
sm_cmd add schedule cli-test-year -T YEA -s 12:20 -D 2 -M 3 -w 2:00



Task event

Usage:

sm_cmd <add|modify|remove> taskevent <ID> [OPTIONS...]

Options:

  -j   task (* -G or -j, reference tasks)
  -G   task group (* -G or -j, reference task_groups)
  -x   schedule (* action ADD, reference schedules)
  -l   fdi_typ <[CFDI]> (default: 'C')
  -m   media pool *  (reference media_pools)
  -d   drive num  (reference hw_drives)
  -S   interface name  (reference interfaces)
  -p   priority  <0-99>
  -a   on-/offline  <online|offline>

If ID is set to 'auto' SEP sesam creates a unique ID.

Example:

sm_cmd add taskevent auto -x cli_test_daily -j minus_ini -m DISK -l F
sm_cmd add taskevent auto -x cli_test_daily -G all_systemstate -m TAPE -l C
sm_cmd modify taskevent 11 -p 2
sm_cmd remove taskevent 11

Migration event

Usage:

sm_cmd <add|modify|remove> migrationevent <ID> [OPTIONS...]

Options:

  -s   saveset 
  -G   saveset (Group)
  -n   savesetcnt
  -D   targetdrive  (reference hw_drives)
  -M   targetPool  (reference media_pools)
  -S   iName  (reference interfaces)
  -B   date start
  -E   date end
  -R   restoreTask (only available for Modify Action, reference migration_tasks)
  -x   schedule  (* action ADD)
  -p   priority  <[0-99]*>

Example:

sm_cmd add migrationevent auto -x schedule_daily -R migTask01
sm_cmd modify migrationevent 33 -p 2 -x schedule_daily
sm_cmd remove migrationevent 33
sm_cmd start migration D2L -j TEST_BACKUP -l FULL -m DISK -S sesamsrv -T \"2009-10-15 17:23:12\"

Restore event

 Usage: 
 sm_cmd <add|modify|remove> restoreevent <ID> [OPTIONS...]
 <ID> must be unique for add action

Options

  -p   priority (default=1)
  -D   driveNum (opt)  (reference hw_drives>
  -S   interface  (reference interfaces)
  -x   schedule   * (required for action add, reference schedule)
  -T   start time  <yyyy-mm-dd hh:mm:ss>
  -R   only for add/modify action   * (required for action add)

Examples:

sm_cmd  add restoreevent auto -R dummy -x restoreFuture
sm_cmd  add restoreevent 11 -R restoreTask02 -x daily_schedule
sm_cmd  modify restoreevent 11 -R dummy -x weekly_schedule
sm_cmd  remove restoreevent 14

Command event

Usage:

sm_cmd <add|modify> commandevent <ID|auto>> [OPTIONS...]
sm_cmd <start> <command name> [OPTIONS...]

Options:

  -j   command  (* action add, reference commands)
  -x   schedule  (* action add)
  -p   priority  <0-99>
  -S   blocking event

If ID is set to 'auto' SEP sesam creates an unique ID.

Example:

sm_cmd add commandevent auto -j unload_drive -x Unload_Drive_Mo-Fr
sm_cmd remove commandevent 12
sm_cmd start commandevent "List-etc"

Media event

Usage:

sm_cmd <add|modify> mediaevent <ID|auto> [OPTIONS...]
sm_cmd <start> <mediapool> [OPTIONS...]

Options:

  -x   schedule  * (CliAction ADD)
  -m   mediapool  *
  -a   action  <init|readcheck|closetape>  *
            ( <init>       initialise medium
              <readcheck>  read medium
              <closetape>   finish medium
  -d   driveNum <[0-9]*>
  -p   priority <[0-99]>
  -s   suppress
  -G   group flag  <0|1>
  -l   loader  <[0-9]*>
  -E   emergency

If ID is set to 'auto' SEP sesam creates a unique ID.

Example:

sm_cmd add mediaevent auto -x schedule01 -M DISK -a init
sm_cmd modify mediaevent 31 -p 5 -x daily_schedule
sm_cmd remove mediaevent 12
sm_cmd start  DISK -a init


Shortcuts

CLI commands often used are also accessible through CLI shortcuts. The advantage is that the CLI command is shorter and the required parameter dependent on shortcut type will be set automatically.

Example to show the difference between default cli usage and cli with shortcut usage: default :

 >sm_cmd start mediapoolevent DISK -a init -d 2

shortcut:

 >sm_cmd init -d 2 -m DISK


Following Examples show all available shortcuts:

Init Media Pool:

 >sm_cmd init -d 2 -m DISK

Init Media:

 >sm_cmd init -d 1 -t TAPE00002

Start Backup

 >sm_cmd backup -j TEST_BACKUP -m DISK

Start Backup Group

 >sm_cmd backup -G SYSTEM -m Month -l diff

Start Restore Task

 >sm_cmd restore -s <ssid> -R /tmp

Start Migration Task

 >sm_cmd migrate -s <ssid> -D 1 -M DISK

Additional features

Send email

Create an account

Usage:

 sm_cmd <add|modify|remove> mailaccount <account name> [OPTIONS...]

Options:

  -C   Customer
  -s   smtpEmailAddress *
  -h   smtpServer *
  -u   mailUser
  -p   mailPassword
  -t   mailTo
  -c   mailCC
  -b   mailBCC
  -S   ServiceLocation
  -P   smtpPort

Example:

sm_cmd add mailaccount SEPsesam -h buildfix -s testmail@sep.de
sm_cmd remove mailaccount mailacc01

Send an email

Usage:

sm_cmd <send> mail <accountname|NONE> [OPTIONS...]

Options:

  -t <recipient>            set the mail address of the To (primary) recipients  * (account = NONE)
  -c <copy recipient>       set the (optional) mail address of the Cc (carbon copy) recipients
  -b <blind copy recipient> set the (optional) mail address of the Bcc (blind carbon copy) recipients
  -f <from>                 set the smtp email address of the sender  * (account = NONE)
  -h <host>                 set the providers smtp server name to use  * (account = NONE)
  -s <subject>              set the subject of the mail  *
  -m <"message">            set the message of the mail  *
  -M <"filename">           set the message text via external file content
  -a <attachment1>[,<attachment i>]
                            set the optional attached files of the mail
  -u <username>             set the mail account (optional) users name
  -p <password>             set the mail account (optional) password
  -v [0|1]                  set the optional verbose level

If the account name is 'NONE' the parameters <-t, -f, -h> are mandatory.

Example:

sm_cmd send mailer sesam -s 'Sesam backup status' -m "testMessage"
sm_cmd send mailer NONE -s 'Sesam backup status' -m "testMessage" -t cg@sep.de -f smptinfo@sep.de -h hotfix

Update GUI

Usage:

sm_cmd update [OPTIONS...]

Options:

  -a   alternative path for Jar File

Direct access to the SEP sesam database

Attention: DB Direct Access

When executing a direct SQL command there is no validation check of the command. Therefore an incorrect use (update or delete) can destroy the SEP sesam database! Please be EXTREMELY careful when using a SQL command directly.


Usage:

sm_cmd sql "<SQL statement>"

Example:

sm_cmd sql"select * from clients"
sm_cmd sql"update clients set comment='Application server' where id=25"

Format outputs of 'SELECT' SQL queries



Errorcodes

In case of an error the CLI returns a specific error code which describes the error type.

See the following list of error codes:

Error Code Error Type
2 CLIException
3 SQLException
4 NumberFormatException
5 RemoteException
6 FileNotFoundException
7 IOException
8 InvocationTargetException
9 unknown Exception




Syntax examples

Construct a backup event

Location
Create a new Location SEP-MUNICH with a Location-ID=33.

sm_cmd add location 33 -L SEP-MUNICH

Backup client
In the next step a new Linux backup client with the hostname lx01 will be registered and assigned to the location SEP-MUNICH.

sm_cmd add client lx01 -o LINUX -a CTRL -L 33

Backup task
Create two backup tasks for client lx01 with the backup sources /etc and a complete backup of the local machine without the directory /tmp.

sm_cmd add task lx01_etc -c lx01 -s /etc
sm_cmd add task lx01_all -c lx01 -x '\./tmp$' -s All

Schedule
Create two new schedules. One for backups on every day of a week at 10 p.m. and the second for backup on every Sunday at 9 p.m.

sm_cmd add schedule daily-backup -T DAY -s 22:00
sm_cmd add schedule sunday-backup -T WEE -s 21:00 -d su

Events for the schedules
After the creation of the schedules the backup tasks will be combined with the schedules to backup events.

  • On every Sunday a full backup of the backup task lx01_etc to the mediapool WEEK will be executed with priority 2.
sm_cmd add taskevent auto -j lx01_etc -s sunday-backup -m WEEK -l FULL -p 2
  • On other days the backup task lx01_etc will be executed as a differential backup to the mediapool DAY. Every Sunday the priority 2 backup of the schedule sunday-backup overrides the daily-backup schedule with prio 1. The prio 1 backup is then suppressed.
sm_cmd add taskevent auto -j ly01_etc -s daily-backup -m DAY -l DIFF -p 1
  • Sundays a full backup of the task lx01_all will be executed as copy backup to the mediapool WEEK.
sm_cmd add taskevent auto -j lx01_all -s sunday-backup -m WEEK -l COPY
Personal tools