updates for scripts
This commit is contained in:
@@ -96,12 +96,12 @@ popd >> /dev/null
|
|||||||
|
|
||||||
# copy output to storage
|
# copy output to storage
|
||||||
if [ -z "$suppress_storage_copy" ]; then
|
if [ -z "$suppress_storage_copy" ]; then
|
||||||
cp "$output_directory_touser"/* "$storage_directory"/
|
cp "$output_directory_touser"/* "$storage_directory"/ 2>/dev/null
|
||||||
cp "$output_directory_nottouser"/* "$storage_directory"/
|
cp "$output_directory_nottouser"/* "$storage_directory"/ 2>/dev/null
|
||||||
cp "$cleaned_input_directory"/* "$storage_directory"/
|
cp "$cleaned_input_directory"/* "$storage_directory"/ 2>/dev/null
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# notify given url of completion
|
# notify given url of completion
|
||||||
if [ -n "$notify_url" ]; then
|
if [ -n "$notify_url" ]; then
|
||||||
wget -qO- "$notify_url" # &> /dev/null 2>&1
|
wget -qO- -t 1 "$notify_url" # &> /dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -89,7 +89,15 @@ pid_path="$working_directory/$pid_filename"
|
|||||||
|
|
||||||
## Process task
|
## Process task
|
||||||
if [ "$task" = "launch" ]; then
|
if [ "$task" = "launch" ]; then
|
||||||
# TODO: verify process isn't running yet
|
# verify process isn't running yet
|
||||||
|
pid=$(head -n 1 $pid_path)
|
||||||
|
# if the pid exists, check the process status using ps
|
||||||
|
if ps -p $pid > /dev/null; then
|
||||||
|
# if it is in ps, then it's still running
|
||||||
|
echo still running
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
piscal_config_file="$working_directory"/piscal.cfg
|
piscal_config_file="$working_directory"/piscal.cfg
|
||||||
# write config file for piscal
|
# write config file for piscal
|
||||||
echo $photosynthetic_type > "$piscal_config_file"
|
echo $photosynthetic_type > "$piscal_config_file"
|
||||||
@@ -110,7 +118,7 @@ if [ "$task" = "launch" ]; then
|
|||||||
nohup ${command} > $working_directory/$stderr_filename 2>&1 &
|
nohup ${command} > $working_directory/$stderr_filename 2>&1 &
|
||||||
|
|
||||||
# write the PID to a temp file to check for completion later
|
# write the PID to a temp file to check for completion later
|
||||||
echo $! > $working_directory/$pid_filename
|
echo $! > $pid_path
|
||||||
echo started
|
echo started
|
||||||
elif [ "$task" = "get_status" ] || [ "$task" = "get_status_cleaned_input" ]; then
|
elif [ "$task" = "get_status" ] || [ "$task" = "get_status_cleaned_input" ]; then
|
||||||
# if the pid doesn't exist, then process hasn't started
|
# if the pid doesn't exist, then process hasn't started
|
||||||
@@ -140,24 +148,32 @@ elif [ "$task" = "get_status" ] || [ "$task" = "get_status_cleaned_input" ]; the
|
|||||||
echo complete
|
echo complete
|
||||||
if [ "$task" = "get_status" ]; then
|
if [ "$task" = "get_status" ]; then
|
||||||
echo "#touser"
|
echo "#touser"
|
||||||
find "$output_directory"/*
|
find "$output_directory"/* 2>/dev/null
|
||||||
|
|
||||||
cleaned_input_directory="$working_directory/$cleaned_input_directory_name"
|
cleaned_input_directory="$working_directory/$cleaned_input_directory_name"
|
||||||
echo "#clninput"
|
echo "#clninput"
|
||||||
find "$cleaned_input_directory"/*
|
find "$cleaned_input_directory"/* 2>/dev/null
|
||||||
|
|
||||||
nottouser_directory="$working_directory/$nottouser_directory_name"
|
nottouser_directory="$working_directory/$nottouser_directory_name"
|
||||||
echo "#nottouser"
|
echo "#nottouser"
|
||||||
find "$nottouser_directory"/*
|
find "$nottouser_directory"/* 2>/dev/null
|
||||||
|
exit 0
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
elif [ "$task" = "cleanup" ]; then
|
elif [ "$task" = "cleanup" ]; then
|
||||||
|
pid=$(head -n 1 $pid_path)
|
||||||
|
# if the pid exists, check the process status using ps
|
||||||
|
if ps -p $pid > /dev/null; then
|
||||||
|
# if it is in ps, then it's still running
|
||||||
|
echo still running
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
rm -rf "$working_directory"
|
rm -rf "$working_directory"
|
||||||
elif [ "$task" = "kill" ]; then
|
elif [ "$task" = "kill" ]; then
|
||||||
# if the pid doesn't exist, then process hasn't started
|
# if the pid doesn't exist, then process hasn't started
|
||||||
if [ ! -f "$pid_path" ]; then
|
if [ ! -f "$pid_path" ]; then
|
||||||
echo "not started"
|
echo "not started"
|
||||||
exit
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
pid=$(head -n 1 $pid_path)
|
pid=$(head -n 1 $pid_path)
|
||||||
|
|||||||
Reference in New Issue
Block a user