heroweb/svelte/auth/run.sh
2024-09-13 16:00:11 +03:00

49 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
set -e
BASE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
cd ${BASE_DIR}
#install hero if not done yet
if ! command -v hero &> /dev/null; then
curl https://raw.githubusercontent.com/freeflowuniverse/crystallib/development/scripts/install_hero.sh > /tmp/hero_install.sh
bash /tmp/hero_install.sh
fi
hero git clone -u https://github.com/svar-widgets/filemanager-backend-go
pushd ${HOME}/code/github/svar-widgets/filemanager-backend-go
# Check if filemanager-go exists, if not, build it
if [ ! -f "filemanager-go" ]; then
go build
fi
function manage_filemanager {
set +ex
pkill -f filemanager-go &> /dev/null
screen -S filemanager -X quit &> /dev/null
set -e
#${HOME}/code/github/svar-widgets/filemanager-backend-go/filemanager-go ${HOME}/code
screen -S filemanager -dm bash -c "${HOME}/code/github/svar-widgets/filemanager-backend-go/filemanager-go ${HOME}/code"
sleep 0.5
nc -zv localhost 3200
if [ $? -eq 0 ]; then
echo "Filemanager on port 3200 is running."
else
echo "Error: Filemanager port 3200 is not accessible."
fi
#screen -r filemanager
}
manage_filemanager
popd &> /dev/null
pushd ${BASE_DIR}/myfiles