updates for scripts

This commit is contained in:
2017-02-08 09:46:17 -05:00
parent 8099f517e0
commit 2d4d0e2a2f
2 changed files with 26 additions and 10 deletions
+4 -4
View File
@@ -96,12 +96,12 @@ popd >> /dev/null
# copy output to storage
if [ -z "$suppress_storage_copy" ]; then
cp "$output_directory_touser"/* "$storage_directory"/
cp "$output_directory_nottouser"/* "$storage_directory"/
cp "$cleaned_input_directory"/* "$storage_directory"/
cp "$output_directory_touser"/* "$storage_directory"/ 2>/dev/null
cp "$output_directory_nottouser"/* "$storage_directory"/ 2>/dev/null
cp "$cleaned_input_directory"/* "$storage_directory"/ 2>/dev/null
fi
# notify given url of completion
if [ -n "$notify_url" ]; then
wget -qO- "$notify_url" # &> /dev/null 2>&1
wget -qO- -t 1 "$notify_url" # &> /dev/null 2>&1
fi
+22 -6
View File
@@ -89,7 +89,15 @@ pid_path="$working_directory/$pid_filename"
## Process task
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
# write config file for piscal
echo $photosynthetic_type > "$piscal_config_file"
@@ -110,7 +118,7 @@ if [ "$task" = "launch" ]; then
nohup ${command} > $working_directory/$stderr_filename 2>&1 &
# write the PID to a temp file to check for completion later
echo $! > $working_directory/$pid_filename
echo $! > $pid_path
echo started
elif [ "$task" = "get_status" ] || [ "$task" = "get_status_cleaned_input" ]; then
# 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
if [ "$task" = "get_status" ]; then
echo "#touser"
find "$output_directory"/*
find "$output_directory"/* 2>/dev/null
cleaned_input_directory="$working_directory/$cleaned_input_directory_name"
echo "#clninput"
find "$cleaned_input_directory"/*
find "$cleaned_input_directory"/* 2>/dev/null
nottouser_directory="$working_directory/$nottouser_directory_name"
echo "#nottouser"
find "$nottouser_directory"/*
find "$nottouser_directory"/* 2>/dev/null
exit 0
fi
fi
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"
elif [ "$task" = "kill" ]; then
# if the pid doesn't exist, then process hasn't started
if [ ! -f "$pid_path" ]; then
echo "not started"
exit
exit 1
fi
pid=$(head -n 1 $pid_path)