Upload files to "misc/scripts"

main
千住柱間 2024-04-06 05:08:55 +00:00
parent dd66caedc8
commit 7e64b143db
1 changed files with 27 additions and 0 deletions

27
misc/scripts/forgejo.sh Normal file
View File

@ -0,0 +1,27 @@
EXEC_SHELL_PATH=$(command -v bash)
# Define the forgejo folder and log file path
FORGEJO_FOLDER="/mnt/Data/forgejo/"
LOG_SERVICE="/tmp/tunneling_service.log"
LOG_FILE="/tmp/forgejo.log"
# Create the log directory if it doesn't exist
mkdir -p "$(dirname "$LOG_FILE")"
mkdir -p "$(dirname "$LOG_SERVICE")"
# Check if the hdd is mounted
if [ ! -d "$FORGEJO_FOLDER" ]; then
echo -e "\e[91mMount the hard drive first!\e[0m"
exit 1
fi
# Check if Forgejo is already running
if pgrep -x "forgejo" > /dev/null; then
echo "Forgejo is already running. Exiting."
else
# Run forgejo command, redirecting output to the log file and detaching it from the terminal
setsid nohup forgejo -w "$FORGEJO_FOLDER" > "$LOG_FILE" 2>&1 &
setsid nohup ~/.local/bin/loophole http 3000 --hostname ajattix > "$LOG_SERVICE" 2>&1 &
echo "Forgejo started and detached from the terminal."
fi