Quantcast
Channel: Attunity Integration Technology Forum
Viewing all articles
Browse latest Browse all 411

Powershell script to request control operations for multiple tasks

$
0
0
This script starts with the GETSERVERSTATUS parsing in Powershell described Here
It expands on that script to request operations like LIST,STOP, RESUME, FRESH, FULL, ROLL and EXPORT for each selected task.
The script executes the requested actions as individual REPCTL commands for each task selected.
On successful requests it deletes the resulting REPCMD.LOG to avoid clutter.
Please note that these commands are only REQUESTS.
The script does not wait for completion, as it uses the 'CONNECT IP=' method.
The script does not know whether the requested action succeeded (except for EXPORT and LIST)

Give it a whirl?

Here is an example EXPORT request, with REGULAR EXPRESSION for task name match:

Code:

PS > .\ControlTasks.ps1 EXPORT -Include "Dev|ark" -Suffix _yyyyMMdd
-- EXPORT - "Attunity_Dev" on LOCALHOST
-- EXPORT - "New Dev Task With Spaces" on LOCALHOST
-- EXPORT - "mark-test" on LOCALHOST
*******************************************************************************


Finished 2016-11-05 23:26:55. 3 tasks matched selection

This results in:
Code:

Directory of C:\Program Files\Attunity\Replicate\data\imports

11/05/2016  11:26 PM            5,625 Attunity_Dev_20161105.json
11/05/2016  11:26 PM            3,202 New Dev Task With Spaces_20161105.json
11/05/2016  11:26 PM            4,118 mark-test_20161105.json

Here is the build-in HELP:

Code:

PS > .\ControlTasks.ps1 help

  ControlTasks.ps1  Hein van den Heuvel, Attunity, 5 November 2016


    This script can be used LIST, RUN or STOP multiple tasks on a Replicate Server
        It uses the unsupported Replicate commandline tool REPCTL to accomplish this.
        The script removes the resulting REPCMD.LOG files if a command reports Success.


    Main Argument:
                <none> - All TASKs will be listed with their state.


    Main Options with their defaults:
                -Action            LIST, STOP, RESUME, FRESH, FULL, ROLL, EXPORT    : LIST
                -Include            Regular Expression for Task names to INCLUDE    : %
                -Exclude            Regular Expression for Task names to EXCLUDE    :
                                    -- for example "^test" to select names starting with "test"
                -State              Regular Expression for Task states to INCLUDE    :
                                    -- for example STOP, "RUN|START", ERROR,...
                -Suffix            Get-Date format string for EXPORT files.  Example: "_yyyyMMdd"
                                    -- Only implemented for LOCALHOST (default)


    Optional environment settings (Limited testing)
                -RepServer          Which Replicate Server to execute commands on    : localhost
                -Repctl            Full filename for REPCTL (client side)          : repctl
                -Data              Directory Path for Replicate Data (client side)  :


Enjoy!
Hein van den Heuvel
Attached Files

Viewing all articles
Browse latest Browse all 411

Trending Articles