Update launch scripts to sort storage by input/output and year
This commit is contained in:
@@ -164,6 +164,7 @@
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<None Include="packages.config" />
|
||||
<None Include="Remote\subdir_year.sh" />
|
||||
<None Include="Remote\piscal_launcher.cfg" />
|
||||
<None Include="Remote\piscal_launcher.sh" />
|
||||
<None Include="Remote\piscal_manager.sh" />
|
||||
|
||||
@@ -98,7 +98,15 @@ popd >> /dev/null
|
||||
if [ -z "$suppress_storage_copy" ]; then
|
||||
cp "$output_directory_touser"/* "$storage_directory"/output/ 2>/dev/null
|
||||
cp "$output_directory_nottouser"/* "$storage_directory"/output/ 2>/dev/null
|
||||
cp "$cleaned_input_directory"/* "$storage_directory"/output/ 2>/dev/null
|
||||
cp "$cleaned_input_directory"/* "$storage_directory"/input/ 2>/dev/null
|
||||
|
||||
mv_script=$base_directory/subdir_year.sh
|
||||
pushd "$storage_directory"/output >> /dev/null
|
||||
"$mv_script"
|
||||
popd >> /dev/null
|
||||
pushd "$storage_directory"/input >> /dev/null
|
||||
"$mv_script"
|
||||
popd >> /dev/null
|
||||
fi
|
||||
|
||||
# notify given url of completion
|
||||
|
||||
@@ -90,9 +90,9 @@ pid_path="$working_directory/$pid_filename"
|
||||
## Process task
|
||||
if [ "$task" = "launch" ]; then
|
||||
# verify process isn't running yet
|
||||
pid=$(head -n 1 $pid_path)
|
||||
pid=$(head -n 1 $pid_path 2>/dev/null)
|
||||
# if the pid exists, check the process status using ps
|
||||
if ps -p $pid > /dev/null; then
|
||||
if ps -p $pid &>/dev/null; then
|
||||
# if it is in ps, then it's still running
|
||||
echo still running
|
||||
exit 1
|
||||
@@ -127,7 +127,7 @@ elif [ "$task" = "get_status" ] || [ "$task" = "get_status_cleaned_input" ]; the
|
||||
exit
|
||||
fi
|
||||
|
||||
pid=$(head -n 1 $pid_path)
|
||||
pid=$(head -n 1 $pid_path 2>/dev/null)
|
||||
# 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
|
||||
@@ -161,7 +161,7 @@ elif [ "$task" = "get_status" ] || [ "$task" = "get_status_cleaned_input" ]; the
|
||||
fi
|
||||
fi
|
||||
elif [ "$task" = "cleanup" ]; then
|
||||
pid=$(head -n 1 $pid_path)
|
||||
pid=$(head -n 1 $pid_path 2>/dev/null)
|
||||
# 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
|
||||
@@ -176,7 +176,7 @@ elif [ "$task" = "kill" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
pid=$(head -n 1 $pid_path)
|
||||
pid=$(head -n 1 $pid_path 2>/dev/null)
|
||||
# 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
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
#!/bin/bash
|
||||
|
||||
for file in *; do
|
||||
## Skip unless this is a file
|
||||
if [ -f "$file" ]; then
|
||||
## get the first four characters from filename, aka the year
|
||||
target="${file:0:4}"
|
||||
## Create the target directory if it doesn't exist
|
||||
[ -d "$target" ] || mkdir "$target" 2>/dev/null
|
||||
## Move the current file
|
||||
mv "$file" "$target" 2>/dev/null
|
||||
fi
|
||||
done
|
||||
|
||||
Reference in New Issue
Block a user