Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
sabbath88 authored Sep 24, 2023
2 parents 6a030bc + 8f03828 commit 72e0473
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 23 deletions.
15 changes: 8 additions & 7 deletions scripts/chce_LAMP_FastCGI.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
# Edited and modified by: Andrzej 'Ferex' Szczepaniak & Jarosław 'Evilus' Rauza

apt update
apt install -y software-properties-common
apt install -y software-properties-common

# Repozytoria zewnętrzne z PHP 8.0 i najnowszym Apachem (nie ma ich w standardowym Ubuntu)
# Repozytoria zewnętrzne z PHP i najnowszym Apachem (nie ma ich w standardowym Ubuntu)
add-apt-repository -y ppa:ondrej/apache2
add-apt-repository -y ppa:ondrej/php

# apache + najpopularniejsze moduły do PHP oraz memcached
apt install -y apache2 libapache2-mod-fcgid php8.0 php8.0-fpm php8.0-memcached php8.0-memcache php8.0-zip php8.0-xml php8.0-sqlite3 php8.0-pgsql php8.0-mysql php8.0-mcrypt php8.0-mbstring php8.0-intl php8.0-gd php8.0-curl php8.0-cli php8.0-bcmath
apt install -y apache2 libapache2-mod-fcgid php php-fpm php-memcached php-memcache php-zip php-xml php-sqlite3 php-pgsql php-mysql php-mcrypt php-mbstring php-intl php-gd php-curl php-cli php-bcmath

# zmiana mpm_prefork na mpm_event, mpm-prefork działa kiedy instalujemy libapache2-mod-php, zaś event dla php-fpm
a2dismod mpm_prefork
Expand All @@ -23,11 +23,12 @@ a2enmod rewrite setenvif proxy proxy_fcgi
# instalacja memcached
apt install memcached libmemcached-tools -y

# aktywacja konfiguracji modułu php8.0-fpm dla apache2
a2enconf php8.0-fpm
# aktywacja konfiguracji modułu php-fpm dla apache2
PHP_VERSION="$(/usr/bin/php.default -v | head -1 | cut -c5-7)"
a2enconf php"$PHP_VERSION"-fpm

# restart usługi po dodaniu nowego modułu
systemctl restart apache2
apache2ctl restart

# dodanie MariaDB (klient i serwer)
apt install -y mariadb-server mariadb-client
Expand All @@ -39,7 +40,7 @@ systemctl start mariadb
systemctl enable apache2
systemctl enable mariadb

# Usuwamy domyślną
# Usuwamy domyślną
rm /var/www/html/index.html

# Dowód na działanie PHP
Expand Down
33 changes: 19 additions & 14 deletions scripts/chce_postgres_backup.sh
Original file line number Diff line number Diff line change
@@ -1,29 +1,34 @@
#!/bin/bash

#In "xxx" place put your data
#In "your_location" place put your data
#Location to place backups.
BACKUP_DIR="/storage/xxx/"
BACKUP_DIR="/storage/your_location/"

#String to append to the name of the backup files
BACKUP_DATE=`date +%d-%m-%Y-%H%M%S`

#DataBase settings
DB_NAME="xxx"
DB_HOST="xxx"
DB_PORT="xxx"
DB_USER="postgres"
DB_PASSWORD="xxx"
#DataBase settings keep it secret
DB_NAME="data_base_name"
DB_HOST="data_base_host"
DB_PORT="data_base_port"
DB_USER="data_base_user"
DB_PASSWORD="data_base_password"

#Numbers of days you want to keep copy of your databases
NUMBER_OF_DAYS=180
NUMBER_OF_DAYS=30
echo "Dumping database to ${BACKUP_DIR}${DB_NAME}_${BACKUP_DATE}.sql"

if [ ! -d "${BACKUP_DIR}" ]; then
mkdir -p "${BACKUP_DIR}"
fi

PGPASSWORD="${DB_PASSWORD}" pg_dump -h "${DB_HOST}" -p "${DB_PORT}" -U "${DB_USER}" -d "${DB_NAME}" -w --format=custom | xz > "${BACKUP_DIR}${DB_NAME}_${BACKUP_DATE}.xz"

echo "Dumping database finnish"

find "${BACKUP_DIR}" -type f -prune -mtime +"${NUMBER_OF_DAYS}" -exec rm -f {} \;
# Attempt to create the backup
if PGPASSWORD="${DB_PASSWORD}" pg_dump -h "${DB_HOST}" -p "${DB_PORT}" -U "${DB_USER}" -d "${DB_NAME}" -w --format=custom | xz > "${BACKUP_DIR}${DB_NAME}_${BACKUP_DATE}.xz"; then
echo "Dumping database finished successfully"

# Delete old backups, but only if a current backup exists
find "${BACKUP_DIR}" -type f -prune -mtime +"${NUMBER_OF_DAYS}" -exec rm -f {} \;
echo "Old backups deleted"
else
echo "Error: Dumping database failed"
fi
3 changes: 1 addition & 2 deletions scripts/chce_wireguard.sh
Original file line number Diff line number Diff line change
Expand Up @@ -112,5 +112,4 @@ qrencode -t ansiutf8 </etc/wireguard/wg-client1.conf

# Clean up temporary files
rm -rf /tmp/wireguard-tools
rm -rf /tmp/wireguard-go
rm $GO_ARCHIVE_OUTPUT
rm -rf /tmp/wireguard-go

0 comments on commit 72e0473

Please sign in to comment.