59 lines
1.2 KiB
Bash
59 lines
1.2 KiB
Bash
#!/bin/bash
|
|
# piscal launcher
|
|
|
|
usage="$(basename "$0") [-h] -d working_directory [-f input_filename] -- script to launch Piscal
|
|
|
|
where:
|
|
-h show this help text
|
|
-d working directory
|
|
-f input filename"
|
|
|
|
directory=""
|
|
input_filename=""
|
|
|
|
while getopts "hd:f:" opt; do
|
|
case "$opt" in
|
|
h )
|
|
echo "$usage"
|
|
exit
|
|
;;
|
|
d )
|
|
directory=$OPTARG
|
|
;;
|
|
f )
|
|
input_filename=$OPTARG
|
|
task="process"
|
|
;;
|
|
\?) printf "illegal option: -%s\n" "$OPTARG" >&2
|
|
echo "$usage" >&2
|
|
exit 1
|
|
;;
|
|
esac
|
|
done
|
|
if [ -z "$directory" ]; then
|
|
echo "working directory required (-d)"
|
|
exit 1
|
|
fi
|
|
if [ ! -d "$directory" ]; then
|
|
echo "working directory $directory not found"
|
|
exit 1
|
|
fi
|
|
if [ -z "$input_filename" ]; then
|
|
echo "input filename required (-f)"
|
|
exit 1
|
|
fi
|
|
if [ ! -f "$directory/$input_filename" ]; then
|
|
echo "input filename $directory/$input_filename not found"
|
|
exit 1
|
|
fi
|
|
|
|
output_directory="$directory/output"
|
|
|
|
sleep 1m
|
|
if [ ! -d "$output_directory" ]; then
|
|
mkdir "$output_directory"
|
|
fi
|
|
|
|
# TODO: run actual command
|
|
cp "/home/poprhythm/LeafWebTestOutput"/* "$output_directory"
|