~fkooman/vpn-maint-scripts

ref: c4291d418191c4ac07d3f90a3fe9f354c28ea6d3 vpn-maint-scripts/bin/vpn-maint-update-controller -rwxr-xr-x 786 bytes
c4291d41François Kooman remove some old CentOS stuff 2 months ago
                                                                                
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
#!/bin/sh

if ! [ "root" = "$(id -u -n)" ]; then
    echo "ERROR: ${0} must be run as root!"; exit 1
fi

if ! [ "-y" = "${1}" ]; then
    printf "Did you stop your node(s) first? (y/n) [n]: "; read -r CONFIRM
    if ! [ "${CONFIRM}" = "y" ] && ! [ "${CONFIRM}" = "Y" ]; then
        exit 1
    fi
fi

if [ -f /etc/fedora-release ]; then
    systemctl stop httpd
    systemctl stop php-fpm
    dnf -y --refresh update
    systemctl start php-fpm
    systemctl start httpd
elif [ -f /etc/debian_version ]; then
    PHP_VERSION=$(/usr/sbin/phpquery -V)
    systemctl stop apache2
    systemctl stop "php${PHP_VERSION}-fpm"
    apt update
    apt -y dist-upgrade
    systemctl start "php${PHP_VERSION}-fpm"
    systemctl start apache2
else
    echo "ERROR: OS not supported!"
    exit 1
fi