5 1 0:Managing Commands

From SEPsesam

Welcome to the latest SEP sesam documentation version 5.1.0 Apollon. For previous documentation version(s), check documentation archive.


Commands in SEP sesam enable you to run specific functions on a SEP sesam Client. You can create command tasks, which can be used to perform or automate different actions in SEP sesam environment.


  • A user must be authorized to run the commands on a specific client.
  • By default, only commands entered in the system directory at <SESAM_ROOT>/bin/sesam can be executed. If you want to allow starting commands in other directories, see section Setting permissions to run commands.

How it works

To run different commands in SEP sesam environment, you must first create a command task. Main components of a command task are the command and the additional parameters. A command event is then used to execute a defined command, either as a one-time event, or a scheduled event. A command event complements the command task. A command task can contain just the basic arguments, and the command event can specify the additional options to specialize the command.

For example, you want to create a command to obtain disk usage of a location. the command syntax is as follows:

sm_client du -m d <path>

You can create the following command task to check disk usage of drive C:

sm_client du -m d C:

Then you can create a command event that will run this command either once, or periodically.

If you want to check disk usage of more than one drive, you can create the following basic command task:

 sm_client du -m d

Then you can create command events for all drives you want to check by reusing the command and specifying additional parameters. You can have one command event for drive C: and another one for drive D: where you add C: in the additional parameters for the first command event and D: in the additional parameters for the second command event.

Command task can include the user, under which the command will be run, and the client, on which the command will run. Note that in case the user and client is set both in command task and command event, the settings in command task take precedence and override the settings in the command event.

In command task, a cancellation command can be specified. This command is executed when the original command gets cancelled. Cancellation command enables you to specify a command that can properly end the interrupted execution of a command. For example, you can create an appropriate RMAN script and set it as cancellation command to end the running RMAN process if the initial Oracle RMAN command is cancelled.

In addition, in cancellation commands you can use placeholders $PID, $SID and $CMD (you can also use {PID}, {SID}, and {CMD} in shell scripts). They will get replaced with the process ID, the session ID, or the command parameters of the original command. Note that placeholder $SID can contain several session IDs, separated by a comma and without spaces in between.

An example cancellation command:

sbc -k -l 2 -P $PID

where $PID will get replaced with the process ID.

Creating commands

To create and run a command, a command task should be created first, and then a command event. The command event can be started immediately or scheduled for automatic or periodic execution.

For instructions on how to create and schedule a command, see Creating a Command Event.

Managing commands

Immediate start

To override the scheduled start time for an event or to trigger the command or command event to run at custom time, you can use the Immediate Start option.

From Main Selection -> Tasks -> Commands, right-click a command or a command event you want to trigger and then click Immediate Start. The procedure is slightly different for commands and command events.

Triggering a command event
When you trigger the command event, you can select the priority for the event and select the start time. You can start the command event now, or define a custom start date and time to postpone the immediate start to a more convenient time.
Triggering a command
When you trigger the command, you can review and modify the command settings, specifying any additional parameters or options as required. If you want to postpone the start to a more convenient time, you can switch to Execution Time tab and define a custom start date and time.

Cancelling a command event

In case you want to cancel a running command event, go to Main Selection -> Job State -> All Results. Select the active command event you want to cancel and click Cancel in the menu bar of the All Results view.

When you cancel a command event (in GUI or in CLI) and an abort command is triggered and executed, the results for the command event display state Canceled. In case the original command event is terminated due to some other reason, the results show state Error. For details on command execution check the System Logs.

Setting permissions to run commands

Not every user on a specific client is authorized to run all commands. Without additional entries authorizing selected users to run certain commands, commands can only be run from the system directory <SESAM_ROOT>/bin/sesam. If a command is to be started from another directory before the regular backup is started, this must be entered/allowed on the target client.


Copy the file sesam_cmdusers.allow from the directory <SESAM_ROOT>/skel/templates to /etc on the client and modify the file. You can now enter a line for the user and the command in the format {user} {command}. If you use a wildcard (*), all commands will be executed.

No explicit permissions are required to execute SEP sesam commands such as sm_loader.


To set access rights for the user and command, use the following registry key: \\HKLM\SOFTWARE\SEP Elektronik GmbH\sesam\CommandEvents\ <user>\ <command>

  1. Open the Regedit editor.
  2. Go to HKEY_LOCAL_MACHINE\SOFTWARE\SEP Elektronik GmbH\sesam\ and create a new key named CommandEvents. If it does not already exist, right click and select New Key.
  3. Enter <user> and then <command> with the full path information as the key.

The available commands are:

Command Execution
* all commands
cmd /c all DOS commands (dir, etc.)
DOS command (e.g., dir) specific DOS command only (e.g., dir)
specific command (e.g., ping) specific command only (e.g., ping)

If there are other commands, the last command is executed. If you use a wildcard (*), all commands are executed.

Below is an example of a registry file (*.reg) that allows all command events for the administrator and the sesam user:

Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\SEP Elektronik GmbH\sesam\CommandEvents\sesam\*]
[HKEY_LOCAL_MACHINE\SOFTWARE\SEP Elektronik GmbH\sesam\CommandEvents\Administrator\*]
The most common errors when setting up the desired user permissions and allowed commands are:
  • The necessary entries are not entered in the directories of the target clients, are not entered on the server, or are entered incorrectly.
  • Instead of entering a command as a key, it is entered as a string.

See also

Managing Events - Creating Follow-up EventsCreating a ScheduleAbout Scheduling

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.