serviced script
The serviced script command verifies or performs the commands in a script file.
USAGE
A script file is a text file that contains commands to automate common or repetitive tasks and tasks that might require specific services or conditions.
The serviced script command provides three subcommands.
- help
- Display the help message.
- parse
- Verify the syntax of a script file.
- run
- Perform the commands in a script file.
- If a script file does not include REQUIRE_SVC, no additional
parameters are required. For
example:
serviced script run task1.txt
- If a script file includes REQUIRE_SVC, the
--service parameter is required. For
example:
serviced script run task2.txt --service Zenoss.core
The log file of a serviced script run invocation is /var/log/serviced/script-TIMESTAMP-$USER.log
SYNTAX
The script file syntax rules are as follows:
- Lines that contain no text and lines that start with the number sign character (#) are ignored.
- Lines are terminated with LF or CR+LF.
- A command and its arguments cannot span lines.
- The maximum number of characters per line (command and arguments) is 300000.
- Unless otherwise noted, all command arguments are treated as strings.
COMMANDS
Commands are performed in the order in which they occur in a script. Scripts terminate on completion and when a command returns an exit code other than zero.
- DESCRIPTION argument...
- A statement about the script.
- VERSION argument
- A revision reference for the script.
- REQUIRE_SVC
- The script needs a reference service in order to perform some or all of its tasks. The service is specified with the --service parameter of the serviced script run command.
- SNAPSHOT
- Perform a snapshot. If a script command fails, serviced rolls back to the most recent snapshot.
- SVC_USE Image-ID
- Use the specified image for script commands that occur after this SVC_USE command. If your application uses multiple images, enter additional SVC_USE commands to specify each image. If the specified image is not present in the local Docker registry, serviced attempts to pull it from Docker Hub.
- SVC_RUN Service Run-Command arguments
- Invoke one of the pre-defined commands associated with a service.
- SVC_EXEC [COMMIT|NO_COMMIT] Service argument...
- Start a new container to run arbitrary commands. (Equivalent to a non-interactive invocation of serviced service shell.)
- SVC_START {auto|recurse} Service
- Start a new instance of Service.
- SVC_STOP {auto|recurse} Service
- Stop the specified service.
- SVC_RESTART {auto|recurse} Service
- Restart the specified service.
- SVC_WAIT Service... [started|stopped|paused] Duration
- Pause Duration seconds, or pause until the specified service or services reach the started, stopped, or paused state. If the state is not reached when Duration expires, the command fails.