forked from TWCable/grabbit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgrabbit.sh
More file actions
executable file
·46 lines (38 loc) · 1.18 KB
/
grabbit.sh
File metadata and controls
executable file
·46 lines (38 loc) · 1.18 KB
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
36
37
38
39
40
41
42
43
44
45
46
#!/bin/bash
# Simple Script to initialize one or more Sync or Grab jobs for one or more paths
# Sample usage :
# sh grabbit.sh
# Follow along to enter configuration information
# Follow along to get status of the jobs
#### Constants
GRABBIT_URL="/grabbit/job"
echo "Enter Client [http(s)://server:port] to initiate Grabbit request "
read client
echo
echo "Client Username :"
read username
echo
echo "Client Password :"
read password
echo
echo "Enter path to your Grabbit Configuration file"
read configpath
# Kick off Grabbit jobs
clear
`curl -v -X PUT -H "Content-Type: application/json" -d "@$configpath" -u $username:$password $client$GRABBIT_URL`
echo "~~~~~~~~~~~Jobs kicked off ~~~~~~~~~~~~~"
echo
echo "~~~~~Client configuration : $client $username $password Config: $configpath~~~~~"
# Monitor Job Status
while true; do
echo
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
read -p "Enter Job Id or \"all\" to get job status or enter 'q' to quit: " id
if [ "$id" == "q" ]; then
exit 0;
fi
statusJson=`curl -u $username:$password --request GET $client$GRABBIT_URL"/"$id.json`
echo
echo "Status for JobId [$id] is :"
echo "$statusJson" | python -m json.tool
done