From e14588d06e40cce3eeef7bd8f38fc4ec5b3d9bc9 Mon Sep 17 00:00:00 2001 From: Bruno21 Date: Sun, 25 Aug 2024 18:47:43 +0200 Subject: [PATCH] 25-08-2024 --- README.md | 70 +++++++++++++++++++++++++++++++++++++++++---- backup_mysql.sh | 9 ++++-- bash_version.sh | 5 ---- urls_check.sh | 76 ------------------------------------------------- urls_list.txt | 60 -------------------------------------- 5 files changed, 71 insertions(+), 149 deletions(-) delete mode 100755 bash_version.sh delete mode 100755 urls_check.sh delete mode 100644 urls_list.txt diff --git a/README.md b/README.md index 29fe05d..c63d704 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,75 @@ -# README +# Scripts bash + +Collection of various bash scripts. +## Getting Started + - **apache_tools.sh**: Edit Apache/PHP/MySQL configurations files, restart Apache, view Log files, switch PHP version -- **backup-conf.sh**: Backup several files and folders and send them on 2 servers (rsync) +- **api_deepl.sh**: Translate text to another language using DeepL API (function translate). Require a $DEEPL_KEY. +- **api-ovh.sh**: +- **backup-conf.sh**: Backup several files and folders and send them on 2 servers (rsync). (uses GPG2 to encrypt certain files) +- **backup_conf.sh**: Copy several .conf files on Mac to destination folder - **backup_Joplin.sh**: Backup all Joplin notes -- **backup_mysql.sh**: Sauvegarde toutes les bases MySQL et les envoie sur 2 serveurs (rsync). -- **bash_tools.sh**: Edit/backup/restore .bash_profile file -- **install_adobe_apps.sh**: installe les apps Adobe (Lightroom, Photoshop) depuis les srveurs Adobe. +- ! **backup_mysql.sh**: Sauvegarde toutes les bases MySQL et les envoie sur 2 serveurs (rsync). (use gpg to decrypt MySQL conf file) +- ! **backup_vps.sh**: Backup files/folders on VPS server and send them to NAS and OVH with rsync. +- **bash_tools.sh**: Edit/backup/restore .bash_profile file. +- **convert-videos-for-plex.sh**: Obsolete. Replaced by **handbrake_for_plex.sh** +- **crypt.sh**: encrypt/decrypt password with openssl. .env file usage. +- curl.sh: +- **curl2.sh**: upload content folder to OVH using curl.(!! PASSWD) +- **exiftool.sh**: display or remove EXIF from picture. (Error !!!) +- **git_reachable.sh**: test if a repo git is reachable. +- **git-sparse.sh**: function git-scp (Error !!!) +- **handbrake_for_plex.sh**: +- **iconv.sh**: converts keywords from utf-8 to ASCII +- **install_adobe_apps.sh**: installe les apps Adobe (Lightroom, Photoshop) depuis les serveurs Adobe. +- **latest_release_on_github.sh**: retrieve the latest release from a GitHub repo with the API. - **mbv-gitea-upd.sh**: met à jour Gitea sur maboiteverte.fr - **mkbuild.sh**: Build MkDocs project and send him on 2 servers (rsync) -- **syno-cron-gitea-update.sh**: met à jour Gitea sur le NAS Syno +- **ovh_api.sh:** OVH API usage (functions: add_cname, remove_cname, refresh, export_zone)(require OVH_CONSUMER_KEY, OVH_APP_KEY, OVH_APP_SECRET) +- ! **photo_du_mois.sh**: +- **purge_server.sh**: libère de la place sur le VPS 1and1 +- **reachable.sh**: vérifie si les serveurs sont joignables avec ping, nc & nmap +- **remote_scripts.sh**: exécute des scripts via ssh sur maboiteverte.fr +- **rename_series.sh**: renomme les séries. Utilisé dans **handbrake_for_plex.sh**. +- **rsync-retry.sh**: runs rsync, retrying on errors up to a maximum number of tries. +- **run.sh**: menu pour lancer updates.sh, mkdocs serve, mkbuid.sh, photo_du_mois.sh +- **server.sh**: liste des serveurs/users/dest/port +- **sphp.sh**: change PHP version +- **sphp_php-fpm.sh**: change PHP -FPM version +- ssl-cert-info.sh: +- **syno-cron-gitea-update.sh**: met à jour Gitea (binaire) sur le NAS Syno. +- **thumbsup-npm.sh**: exécute `thumbsup --config="$config_file"` pour créer une galerie Thumbsup. +- **update_container.sh**: recherche les M-à-J de containers Docker. +- **upgrade_nextcloud.sh**: met à jour Nextcloud sur le NAS ou VPS. +- **urls_check.sh**: check if url is up or down (code 200|301|302\|303) +- **venv_solus.sh**: update apps in Python virtuals environments - **zsh_tools.sh**: Edit/backup/restore .zshrc file +### Prerequisites + +Requirements for the scripts: Bash + + + +## Authors + + - **Billie Thompson** - *Provided README Template* - + [PurpleBooth](https://github.com/PurpleBooth) + +## License + +This project is licensed under the [CC0 1.0 Universal](LICENSE.md) +Creative Commons License - see the [LICENSE.md](LICENSE.md) file for +details + + + + + +- + diff --git a/backup_mysql.sh b/backup_mysql.sh index 01cf848..9b6c9ea 100755 --- a/backup_mysql.sh +++ b/backup_mysql.sh @@ -108,6 +108,8 @@ notification() { DB_LIST="$($MYSQL -u $BKP_USER -h $MYSQL_HOST -p$BKP_PASS -Bse 'SHOW DATABASES')" #DB_LIST="$($MYSQL -h $MYSQL_HOST -Bse 'SHOW DATABASES')" + + # for db in $DB_LIST do @@ -143,9 +145,9 @@ do sleep 1 - server2="clicclac.synology.me:/volume1/Backup/$machine/Bases_MySQL/" + server2="photos-nas.ovh:/volume1/Backup/$machine/Bases_MySQL/" #scp -P42666 -p "$BKP_GZ_FILENAME" bruno@"$server2" - scp -P42666 -p "$BKP_GZ_FILENAME" bruno@"$server2" + scp -P42667 -p "$BKP_GZ_FILENAME" bruno@"$server2" #scp -P42666 -p "$BKP_GZ_FILENAME" bruno@clicclac.synology.me:/volume1/Backup/$machine/Bases_MySQL/ result=$? @@ -155,6 +157,8 @@ do fi done +: <<'END_COMMENT' + #########To delete all backup files older then BKP_DAYS ################# # # Nettoyage serveurs locaux: @@ -238,5 +242,6 @@ done #### End of script #### +END_COMMENT \ No newline at end of file diff --git a/bash_version.sh b/bash_version.sh deleted file mode 100755 index e88d211..0000000 --- a/bash_version.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash - -# https://itnext.io/upgrading-bash-on-macos-7138bd1066ba - -echo $BASH_VERSION diff --git a/urls_check.sh b/urls_check.sh deleted file mode 100755 index c7a807a..0000000 --- a/urls_check.sh +++ /dev/null @@ -1,76 +0,0 @@ -#!/usr/bin/env bash - -italic="\033[3m" -underline="\033[4m" -ita_under="\033[3;4m" -bgd="\033[1;4;31m" -red="\033[1;31m" -bold="\033[1m" -bold_ita="\033[1;3m" -box="\033[1;41m" -redbold="\033[1;31m" -redbox="\033[1;41m" -green="\033[0;32m" -greenbold="\033[1;32m" -reset="\033[0m" - -: << 'COMMENTS' -echo "toto" -COMMENTS - -cat < /dev/null > /dev/tcp/1.1.1.1/53 -if [[ $? -ne 0 ]]; then - echo -e "\n${red}No Internet connection !${reset}" - echo -e "Exit !" - exit 1 -fi - -#urls=("https://clicclac.info" "https://clicclac.info/wordpress" "https://sur-le-sentier.fr" "https://maboiteverte.fr" -# "https://ds923.photos-nas.ovh" "https://portainer.photos-nas.ovh/" "https://dockge.photos-nas.ovh/" "https://kuma.photos-nas.ovh/") -urls=() - -while read -r line -do - urls+=("$line") -done < urls_list.txt - -check() { - website=$(echo "$1" | awk -F "\/\/" '{print $2}') - - # https://developer.mozilla.org/fr/docs/Web/HTTP/Status - - if wget --no-verbose --tries=1 --spider "$1" 2>&1 | grep -w "200\|301" ; then - #echo -e "${greenbold}$1 is up${reset}\n" - echo -e "${greenbold}$website is up${reset}\n" - else - echo -e "${redbold}$1 is down${reset}\n" - fi -} - -check2() { - website=$(echo "$1" | awk -F "\/\/" '{print $2}') - response=$(curl --write-out '%{http_code}' --silent --output /dev/null "$1") - - if [ $(grep -w "200\|301\|302\|303" <<< "$response") ];then - echo -e "${greenbold}$website is up${reset} ($response)\n" - else - echo -e "${redbold}$1 is down${reset} ($response)\n" - fi -} - -info_cn() { - cn=$(echo | openssl s_client -connect $1 2>/dev/null | openssl x509 -noout -subject -dates -issuer) -} - -: << 'COMMENTS2' -COMMENTS2 - -for url in "${!urls[@]}" -do - #check "${urls[$url]}" - check2 "${urls[$url]}" - -done - - -# curl --write-out "%{json}" https://nextcloud.photos-nas.ovh | jq diff --git a/urls_list.txt b/urls_list.txt deleted file mode 100644 index 5c520b2..0000000 --- a/urls_list.txt +++ /dev/null @@ -1,60 +0,0 @@ -https://clicclac.info -https://clicclac.info/wordpress -https://sur-le-sentier.fr -https://maboiteverte.fr -https://photos-nas.ovh -https://airdrop.photos-nas.ovh -https://asus.photos-nas.ovh -https://books.photos-nas.ovh -https://change.photos-nas.ovh -https://chibisafe.photos-nas.ovh -https://dcommander.photos-nas.ovh -https://dockge.photos-nas.ovh -https://docspell.photos-nas.ovh -https://dozzle.photos-nas.ovh -https://drive.photos-nas.ovh -https://ds916.photos-nas.ovh -https://ds923.photos-nas.ovh -https://files.photos-nas.ovh -https://git.photos-nas.ovh -https://gitea.photos-nas.ovh -https://glances.photos-nas.ovh -https://gokapi.photos-nas.ovh -https://gotify.photos-nas.ovh -https://home-assistant.photos-nas.ovh -https://homebridge.photos-nas.ovh -https://igotify.photos-nas.ovh -https://immich.photos-nas.ovh/photos -https://invidious.photos-nas.ovh -https://it-tools.photos-nas.ovh -https://kuma.photos-nas.ovh -https://maloja.photos-nas.ovh -https://maps-server.photos-nas.ovh -https://maps.photos-nas.ovh -https://menu.photos-nas.ovh -https://musiiic.photos-nas.ovh -https://navidrome.photos-nas.ovh -https://nextcloud.photos-nas.ovh -https://notif.photos-nas.ovh -https://paperlessngx.photos-nas.ovh -https://pastebin.photos-nas.ovh -https://photos.photos-nas.ovh -https://pihole1.photos-nas.ovh/admin/login.php -https://pihole2.photos-nas.ovh/admin/login.php -https://pingvin.photos-nas.ovh -https://portainer.photos-nas.ovh -https://psitransfer.photos-nas.ovh -https://seafile.photos-nas.ovh -https://search.photos-nas.ovh -https://send.photos-nas.ovh -https://snippet.photos-nas.ovh -https://syno-dashboard.photos-nas.ovh -https://tautulli.photos-nas.ovh -https://test.photos-nas.ovh -https://tube.photos-nas.ovh -https://tunes.photos-nas.ovh -https://uptime.photos-nas.ovh -https://vault.photos-nas.ovh -https://wg.photos-nas.ovh -https://yacy.photos-nas.ovh -https://yatch.photos-nas.ovh