add url notify options to scripts

This commit is contained in:
2016-05-06 22:46:17 -04:00
parent f4ebeefad1
commit 1ce89a124e
2 changed files with 21 additions and 8 deletions
+2 -3
View File
@@ -18,7 +18,6 @@ input_directory_name="input"
cleaned_input_directory_name="clninput"
touser_directory_name="fitresult/touser"
nottouser_directory_name="fitresult/nottouser"
notify_url=""
# import the settings from piscal.cfg
# $piscal_executable and $storage_directory
@@ -103,6 +102,6 @@ if [ -z "$suppress_storage_copy" ]; then
fi
# notify given url of completion
if [ -z "$notify_url" ]; then
wget -qO- "$notify_url" &> /dev/null
if [ -n "$notify_url" ]; then
wget -qO- "$notify_url" # &> /dev/null 2>&1
fi
+19 -5
View File
@@ -1,16 +1,22 @@
#!/bin/bash
# piscal manager script
usage="$(basename "$0") [-h] -d directory_name -p photosynthetic_type [-s|-c|-k] -- script to manage Piscal
usage="$(basename "$0") [-h]
-d directory_name
[-s|-c|-k]
-p photosynthetic_type
-u notify_url
-t
where:
-h show this help text
-d working directory name
-p photosynthetic type
-s start job
-t suppress storage copy
-c cleanup directory
-k kill job"
-k kill job
-u url to notify on completion
-p photosynthetic type
-t suppress storage copy"
# Initialize variables:
# http://stackoverflow.com/a/246128/99492
@@ -28,7 +34,7 @@ launcher="$base_directory/piscal_launcher.sh"
# http://stackoverflow.com/a/14203146/99492
# http://wiki.bash-hackers.org/howto/getopts_tutorial
while getopts "hd:f:p:stck" opt; do
while getopts "hd:f:p:stcku:" opt; do
#echo "$opt = $OPTARG"
case "$opt" in
h )
@@ -53,6 +59,9 @@ while getopts "hd:f:p:stck" opt; do
k )
task="kill"
;;
u )
notify_url=$OPTARG
;;
\?) printf "illegal option: -%s\n" "$OPTARG" >&2
echo "$usage" >&2
exit 1
@@ -91,6 +100,11 @@ if [ "$task" = "launch" ]; then
if [ "$suppress_storage_copy" = true ]; then
command="$command -t"
fi
if [ -n "$notify_url" ]; then
command="$command -u $notify_url"
fi
# launch it, sending error output to file
nohup ${command} > $working_directory/$stderr_filename 2>&1 &