2024-04-06 05:08:55 +00:00
|
|
|
EXEC_SHELL_PATH=$(command -v bash)
|
|
|
|
|
|
|
|
# Define the forgejo folder and log file path
|
|
|
|
FORGEJO_FOLDER="/mnt/Data/forgejo/"
|
2024-06-01 05:00:40 +00:00
|
|
|
FORGEJO_CONFIG="/mnt/Data/forgejo/custom/conf/app.ini"
|
2024-04-06 05:08:55 +00:00
|
|
|
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
|
2024-06-01 05:00:40 +00:00
|
|
|
setsid nohup forgejo -w "$FORGEJO_FOLDER" -c "$FORGEJO_CONFIG" > "$LOG_FILE" 2>&1 &
|
2024-04-06 05:08:55 +00:00
|
|
|
setsid nohup ~/.local/bin/loophole http 3000 --hostname ajattix > "$LOG_SERVICE" 2>&1 &
|
|
|
|
echo "Forgejo started and detached from the terminal."
|
|
|
|
fi
|