Skip to content

Commit 036a8ea

Browse files
committed
find command to run from job definition
1 parent 9719e70 commit 036a8ea

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

updater/bin/run

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,18 @@
22
set -e
33

44
command="$1"
5+
6+
# When no command is provided, attempt to read it from job.json
57
if [ -z "$command" ]; then
6-
echo "usage: run [update_files|update_graph]"
7-
exit 1
8+
if [ -f "job.json" ]; then
9+
# Use Ruby to parse the command field; default to update_files unless explicitly graph
10+
command=$(ruby -rjson -e 'j=JSON.parse(File.read("job.json")); c=j.dig("job","command") || ""; puts(c == "graph" ? "update_graph" : "update_files")')
11+
echo "No command argument supplied, found command '$command' from job definition."
12+
else
13+
echo "usage: run [update_files|update_graph]"
14+
echo "Or run without arguments if a job.json file is present."
15+
exit 1
16+
fi
817
fi
918

1019
# ignore fetch_files command for backward compatibility

0 commit comments

Comments
 (0)