Page History
...
The following explanations focus on the scenario to clean up the Daily Plan from past dependencies of a previous day using Unix shell scripts.
Cleanup
Cleanup includes two operations for which script solutions are available:
...
- The workflow makes use of the
Default
job resource, see JS7 - Job Environment Variables and JS7 - Job Resources.- It is not required to use the job resource that is available from JS7 - Download.
- However, the job resource simplifies parameterization of the job.
- Error handling includes to use a JS7 - Try-Catch Instruction that will continue processing with the Catch Block should one of the jobs in the Try Block fail.
Anchor | ||||
---|---|---|---|---|
|
The job makes use of the cancel-order.sh
shell script to cancel orders waiting for past notices from JS7 - Notice Boards.
For details see JS7 - How to cancel orders using the REST Web Service API from the Shell.
Explanations:
- Parameterization of the
cancel-orders.sh
script includes:-url="${JS7_JOC_URL}
: The JOC Cockpit URL is provided from an environment variable that users can specify with theDefault
job resource.-user=root
,--password=root
: The example makes use of of user/password authentication.Anumberofwaysareofferedpassword authentication. A number of ways are offered- JS7 - Use of Credential Store with Shell Jobs: explains how to read accounts and passwords from a credential store.
- JS7 - Identity Services: offer a number of authentication methods such as user/password, LDAP, certificates etc.
- JS7 - How to connect to JOC Cockpit using the PowerShell Module
- x
Job: Delete Notices
x
...
- : provides examples for use of different authentication methods that similarly apply to shell jobs.
--controller-id="${JS7_CONTROLLER_ID}"
: The Controller ID is provided from an environment variable available with theDefault
job resource.--date-to="$(TZ="${JS7_AGENT_TZ}" date --date="1 day ago" +'%Y-%m-%d')T00:00:00"
: Specifies the date and time to which orders have been scheduled that will be cancelled.- The time zone is provided from the
JS7_AGENT_TZ
environment variable available with theDefault
job resource. - The syntax
TZ=<time-zone> date ...
executes thedate
command for the time zone specified. For time zone identifiers see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones.
- The time zone is provided from the
--time-zone="${JS7_AGENT_TZ}"
: Specifies that the Agent's time zone will be used. The value of this option has to match the time zone assumed for the--date-to
option.--states=SCHEDULED,WAITING
: Specifies that orders in the SCHEDULED and WAITING state should be cancelled.
Anchor | ||||
---|---|---|---|---|
|
The job makes use of the delete-notices.sh
shell script to delete notices from JS7 - Notice Boards.
For details see JS7 - How to delete notices using the REST Web Service API from the Shell
Explanations:
- Parameterization of the
delete-notices.sh
script includes:- For parameters related to access and authentication with JOC Cockpit see chapter Job: Cancel-Orders
--date="$(TZ="${JS7_AGENT_TZ}" date --date="1 day ago" +'%Y-%m-%d')"
: Explanations for job Cancel-Orders apply. The difference being that --date expects a date without time as it specifies the day for which notices have been created that should be deleted.--time-zone="${JS7_AGENT_TZ}"
: Specifies that the Agent's time zone will be used. The value of this option has to match the time zone assumed for the--date
option.
Further Resources
- JS7 - How to cancel orders using the REST Web Service API from the Shell
- JS7 - How to delete notices using the REST Web Service API from the Shell
...