mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2025-12-07 09:36:05 -08:00
Some more fixes
This commit is contained in:
@@ -46,14 +46,33 @@ if [ -d "$INSTALL_DIR" ]; then
|
|||||||
read -p "Enter your choice: " confirmation
|
read -p "Enter your choice: " confirmation
|
||||||
fi
|
fi
|
||||||
if [ "$confirmation" == "install" ]; then
|
if [ "$confirmation" == "install" ]; then
|
||||||
if [ -n "$INSTALL_DIR" ] && [ "$INSTALL_DIR" != "" ]; then
|
# Ensure INSTALL_DIR is safe to wipe
|
||||||
|
if [ -n "$INSTALL_DIR" ] && [ "$INSTALL_DIR" != "" ] && [ "$INSTALL_DIR" != "/" ] && [ "$INSTALL_DIR" != "." ] && [ -d "$INSTALL_DIR" ]; then
|
||||||
echo "Removing existing installation..."
|
echo "Removing existing installation..."
|
||||||
|
|
||||||
|
# Stop nginx if running
|
||||||
|
if command -v systemctl >/dev/null 2>&1 && systemctl list-units --type=service | grep -q nginx; then
|
||||||
|
systemctl stop nginx 2>/dev/null
|
||||||
|
elif command -v service >/dev/null 2>&1; then
|
||||||
service nginx stop 2>/dev/null
|
service nginx stop 2>/dev/null
|
||||||
pkill -f "python /app/server" 2>/dev/null
|
fi
|
||||||
umount "$INSTALL_DIR/api" 2>/dev/null
|
|
||||||
umount "$INSTALL_DIR/front" 2>/dev/null
|
# Kill running NetAlertX server processes in this INSTALL_DIR
|
||||||
rm -rf "$INSTALL_DIR/"
|
pkill -f "python.*${INSTALL_DIR}/server" 2>/dev/null
|
||||||
|
|
||||||
|
# Unmount only if mountpoints exist
|
||||||
|
mountpoint -q "$INSTALL_DIR/api" && umount "$INSTALL_DIR/api" 2>/dev/null
|
||||||
|
mountpoint -q "$INSTALL_DIR/front" && umount "$INSTALL_DIR/front" 2>/dev/null
|
||||||
|
|
||||||
|
# Remove all contents safely
|
||||||
|
rm -rf -- "$INSTALL_DIR"/* "$INSTALL_DIR"/.[!.]* "$INSTALL_DIR"/..?* 2>/dev/null
|
||||||
|
|
||||||
|
# Re-clone repository
|
||||||
git clone https://github.com/jokob-sk/NetAlertX "$INSTALL_DIR/"
|
git clone https://github.com/jokob-sk/NetAlertX "$INSTALL_DIR/"
|
||||||
|
else
|
||||||
|
echo "INSTALL_DIR is not set, is root, or is invalid. Aborting for safety."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo "INSTALL_DIR is not set or is root. Aborting for safety."
|
echo "INSTALL_DIR is not set or is root. Aborting for safety."
|
||||||
exit 1
|
exit 1
|
||||||
|
|||||||
@@ -11,10 +11,11 @@ server {
|
|||||||
add_header Cache-Control "no-store";
|
add_header Cache-Control "no-store";
|
||||||
fastcgi_pass unix:/run/php/php8.3-fpm.sock;
|
fastcgi_pass unix:/run/php/php8.3-fpm.sock;
|
||||||
include fastcgi_params;
|
include fastcgi_params;
|
||||||
|
try_files $uri =404;
|
||||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||||
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
|
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
|
||||||
fastcgi_connect_timeout 75;
|
fastcgi_connect_timeout 75;
|
||||||
fastcgi_send_timeout 600;
|
fastcgi_send_timeout 600;
|
||||||
fastcgi_read_timeout 600;
|
fastcgi_read_timeout 600;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user