-
Notifications
You must be signed in to change notification settings - Fork 2
/
run-workflow-remote.sh
35 lines (30 loc) · 963 Bytes
/
run-workflow-remote.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
###############################################
##
## Note: This example will run the "update_asset" workflow
##
###############################################
#
#! /bin/bash
# The host and port of the source server
HOST=""
# The user credentials on the source server (username:password)
LOGIN=""
# Filter path
# eg. "/content/dam/mysite"
PATH=""
# Workflow to run
# eg. "update_asset"
WORKFLOW=""
#If you want to run for only those asset for which property is missing
#MISSING_PROPERTY=dc:format
#Query to get all Dam Asset
ALL_PATHS=`curl -s -u $LOGIN "$HOST/bin/querybuilder.json?path=$PATH&type=dam:Asset&p.limit=-1" | tr "[}{" "\n" | grep path | awk -F \" '{print $4 "\n"}'`
echo "Starting"
echo "$ALL_PATHS"
IFS=$'\n'
for SINGLE_PATH in $ALL_PATHS
do
echo "Fixing $SINGLE_PATH"
curl -s -u $LOGIN -d "model=/etc/workflow/models/dam/update_asset/jcr:content/model&payloadType=JCR_PATH&payload=$SINGLE_PATH" $HOST/etc/workflow/instances
sleep 3
done