CLI main call
Usage:
sm_cmd <parameters> <command> <object> <options>
Parameters:
-v <loglevel> Loglevel
-S <Sesam Server> 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.
Display of SesamDB data
The content of the SesamDB concerning the several actions can be displayed by parameter list.
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 "|"
Output:
id|name|parent|describe|contact|komment
0|LOCAL|NULL|NULL|NULL|NULL
Command:
sm_cmd list locations -d "|" -F noheader
Output:
0|LOCAL|NULL|NULL|NULL|NULL
Command:
sm_cmd list locations -d "|" -F named
Output:
id=0|name=LOCAL|parent=NULL|describe=NULL|contact=NULL|komment=NULL|originalid=0|insert=false|update=false|delete=false
Here some examples for the different format (-F) values:
- Standard display without format parameter
Command:
sm_cmd list locations
Output:
id name parent describe contact komment
0 LOCAL NULL NULL NULL NULL
Command:
sm_cmd list 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
Output:
id=0 name=LOCAL parent=NULL describe=NULL contact=NULL komment=NULL originalid=0 insert=false update=false delete=false
- Output the data as SQL DML command (insert)
Command:
sm_cmd list locations -F export
Output:
INSERT INTO locations (id,name,parent,describe,contact,komment) 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,komment) VALUES (0,'LOCAL',NULL,NULL,NULL,NULL)"
Topology
Location
After the installation of a new SEP sesam server one 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' 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 Sesam server client object aleady exists. You have to register your backup clients in the SEP sesam environment before you can use them. If you add clients with the Sesam GUI during the registration process the Sesam server checks if the client is visible/reachable to the server. This is different with the 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 nesseccary 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 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 Sesam immediately creates the internal drive structures. This will cause an interruption of all running backups. To avoid this, you can use parameter -o noconfig. The drive configuration will be written only into Sesam database. To use the drive for 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
SEPsesam media which are not in archive (default: no)
no : do not introduce any media
take : check if media are exist and valid, if not introduce them
overwrite: same like 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 label is read without retry in case of failure.
Use this switch together with introduce switch only when you are
sure that your call may introduce really 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 genmode without arguments
-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 komment
-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
Schedules & Events
Schedule
If you want to execute your backups on a specific time table you have to create tasks first. Then you must ceate 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' Sesam creates a unique ID.
Example:
sm_cmd add taskevent auto -s cli_test_daily -j minus_ini -m DISK -l F
sm_cmd add taskevent auto -s 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 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 -s restoreFuture
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' Sesam creates an unique ID.
Example:
sm_cmd add commandevent auto -j unload_drive
sm_cmd remove commandevent 12
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' Sesam creates an unique ID.
Example:
sm_cmd add mediaevent auto -s schedule01 -M mediapool01 -a init
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 account name is 'NONE' 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 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 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"
|