-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstirling-pdf.sh
More file actions
executable file
·57 lines (51 loc) · 1.46 KB
/
stirling-pdf.sh
File metadata and controls
executable file
·57 lines (51 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
PODMAN_CONTAINER_DIR="/links/lokal/podman/"
CONTAINER_NAME="stirling-pdf"
mkdir -p "${PODMAN_CONTAINER_DIR}/${CONTAINER_NAME}/trainingData"
mkdir -p "${PODMAN_CONTAINER_DIR}/${CONTAINER_NAME}/extraConfigs"
mkdir -p "${PODMAN_CONTAINER_DIR}/${CONTAINER_NAME}/logs"
function start() {
if [ -n "$(podman ps -f "name=${CONTAINER_NAME}" -f "status=running" -q )" ]; then
echo "${CONTAINER_NAME} is already running!"
else
echo "starting ${CONTAINER_NAME}"
podman run -d \
-p 8080:8080 \
-v "${PODMAN_CONTAINER_DIR}/${CONTAINER_NAME}/trainingData":/usr/share/tesseract-ocr/5/tessdata \
-v "${PODMAN_CONTAINER_DIR}/${CONTAINER_NAME}/extraConfigs":/configs \
-v "${PODMAN_CONTAINER_DIR}/${CONTAINER_NAME}/logs":/logs \
-e DOCKER_ENABLE_SECURITY=false \
--name ${CONTAINER_NAME} \
frooodle/s-pdf:latest
fi
}
function stop() {
podman stop ${CONTAINER_NAME}
podman rm ${CONTAINER_NAME}
}
function usage() {
echo "${0} -r to start ${CONTAINER_NAME}"
echo "${0} -s to stop ${CONTAINER_NAME}"
}
# main
while getopts "rs" OPTNAME
do
case "${OPTNAME}" in
"s")
echo "Option stop ${OPTNAME} is specified"
stop
exit 0
;;
"r")
echo "Option start ${OPTNAME} is specified"
start
sleep 10
xdg-open http://localhost:8080 &
exit 0
;;
esac
#echo "OPTIND is now $OPTIND"
done
usage
exit 1