add url notify options to scripts
This commit is contained in:
@@ -18,7 +18,6 @@ input_directory_name="input"
|
|||||||
cleaned_input_directory_name="clninput"
|
cleaned_input_directory_name="clninput"
|
||||||
touser_directory_name="fitresult/touser"
|
touser_directory_name="fitresult/touser"
|
||||||
nottouser_directory_name="fitresult/nottouser"
|
nottouser_directory_name="fitresult/nottouser"
|
||||||
notify_url=""
|
|
||||||
|
|
||||||
# import the settings from piscal.cfg
|
# import the settings from piscal.cfg
|
||||||
# $piscal_executable and $storage_directory
|
# $piscal_executable and $storage_directory
|
||||||
@@ -103,6 +102,6 @@ if [ -z "$suppress_storage_copy" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# notify given url of completion
|
# notify given url of completion
|
||||||
if [ -z "$notify_url" ]; then
|
if [ -n "$notify_url" ]; then
|
||||||
wget -qO- "$notify_url" &> /dev/null
|
wget -qO- "$notify_url" # &> /dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -1,16 +1,22 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# piscal manager script
|
# 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:
|
where:
|
||||||
-h show this help text
|
-h show this help text
|
||||||
-d working directory name
|
-d working directory name
|
||||||
-p photosynthetic type
|
|
||||||
-s start job
|
-s start job
|
||||||
-t suppress storage copy
|
|
||||||
-c cleanup directory
|
-c cleanup directory
|
||||||
-k kill job"
|
-k kill job
|
||||||
|
-u url to notify on completion
|
||||||
|
-p photosynthetic type
|
||||||
|
-t suppress storage copy"
|
||||||
|
|
||||||
# Initialize variables:
|
# Initialize variables:
|
||||||
# http://stackoverflow.com/a/246128/99492
|
# http://stackoverflow.com/a/246128/99492
|
||||||
@@ -28,7 +34,7 @@ launcher="$base_directory/piscal_launcher.sh"
|
|||||||
# http://stackoverflow.com/a/14203146/99492
|
# http://stackoverflow.com/a/14203146/99492
|
||||||
# http://wiki.bash-hackers.org/howto/getopts_tutorial
|
# 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"
|
#echo "$opt = $OPTARG"
|
||||||
case "$opt" in
|
case "$opt" in
|
||||||
h )
|
h )
|
||||||
@@ -53,6 +59,9 @@ while getopts "hd:f:p:stck" opt; do
|
|||||||
k )
|
k )
|
||||||
task="kill"
|
task="kill"
|
||||||
;;
|
;;
|
||||||
|
u )
|
||||||
|
notify_url=$OPTARG
|
||||||
|
;;
|
||||||
\?) printf "illegal option: -%s\n" "$OPTARG" >&2
|
\?) printf "illegal option: -%s\n" "$OPTARG" >&2
|
||||||
echo "$usage" >&2
|
echo "$usage" >&2
|
||||||
exit 1
|
exit 1
|
||||||
@@ -91,6 +100,11 @@ if [ "$task" = "launch" ]; then
|
|||||||
if [ "$suppress_storage_copy" = true ]; then
|
if [ "$suppress_storage_copy" = true ]; then
|
||||||
command="$command -t"
|
command="$command -t"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -n "$notify_url" ]; then
|
||||||
|
command="$command -u $notify_url"
|
||||||
|
fi
|
||||||
|
|
||||||
# launch it, sending error output to file
|
# launch it, sending error output to file
|
||||||
nohup ${command} > $working_directory/$stderr_filename 2>&1 &
|
nohup ${command} > $working_directory/$stderr_filename 2>&1 &
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user