16-02-2022 (2)
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
[[ $@ =~ "--install" ]] && echo "Let's install...'"
|
||||||
|
|
||||||
#version=7.2
|
#version=7.2
|
||||||
editeur=/usr/local/bin/bbedit
|
editeur=/usr/local/bin/bbedit
|
||||||
|
|
||||||
@@ -15,7 +17,7 @@ vhost=$(grep -e 'httpd-vhosts.conf' "$conf_apa" | awk '{print $2}')
|
|||||||
ssl=$(grep -e 'httpd-ssl.conf' "$conf_apa" | awk '{print $2}')
|
ssl=$(grep -e 'httpd-ssl.conf' "$conf_apa" | awk '{print $2}')
|
||||||
|
|
||||||
# PHP
|
# PHP
|
||||||
v_php=$(php --ini | grep -E 'usr.*ini')
|
v_php=$(php --ini | grep -E "$(brew --prefix).*ini")
|
||||||
php_ini=$(php --ini)
|
php_ini=$(php --ini)
|
||||||
|
|
||||||
|
|
||||||
@@ -54,15 +56,16 @@ options=(
|
|||||||
"(O)pen PHP info page in browser"
|
"(O)pen PHP info page in browser"
|
||||||
"Apache/PHP/MySQL (V)ersion"
|
"Apache/PHP/MySQL (V)ersion"
|
||||||
"Apache/PHP/MySQL (C)onfiguration files"
|
"Apache/PHP/MySQL (C)onfiguration files"
|
||||||
"S(w)itch to PHP version (Brew PHP switcher)"
|
"S(w)itch to PHP version"
|
||||||
#"(U)pdate sphp"
|
"(U)pdate sphp"
|
||||||
"Edit additio(n)nals *.ini files"
|
"Edit additio(n)nals *.ini files"
|
||||||
"(Q)uit"
|
"(Q)uit"
|
||||||
)
|
)
|
||||||
|
|
||||||
# sphp:
|
# --> sphp:<--
|
||||||
# https://gist.github.com/rhukster/f4c04f1bf59e0b74e335ee5d186a98e2/
|
# mod-php: https://gist.github.com/rhukster/f4c04f1bf59e0b74e335ee5d186a98e2/
|
||||||
# remplacé par Brew PHP switcher
|
# php-fpm: https://gist.github.com/rozsival/10289d1e2006c68009ace0478306ecd2/
|
||||||
|
# Brew PHP switcher
|
||||||
# https://github.com/philcook/brew-php-switcher#readme
|
# https://github.com/philcook/brew-php-switcher#readme
|
||||||
|
|
||||||
select option in "${options[@]}"; do
|
select option in "${options[@]}"; do
|
||||||
@@ -76,12 +79,12 @@ select option in "${options[@]}"; do
|
|||||||
7|p|P) "$editeur" "$conf_php" ;; # php.ini
|
7|p|P) "$editeur" "$conf_php" ;; # php.ini
|
||||||
8|o|O) echo '<?php echo phpinfo(); ?>' > $document_root/php-info.php && open 'http://localhost/php-info.php' ;;
|
8|o|O) echo '<?php echo phpinfo(); ?>' > $document_root/php-info.php && open 'http://localhost/php-info.php' ;;
|
||||||
9|v|V) apachectl -v && echo ' ' && php -v && echo ' ' && echo "$v_php_apache (Apache)" && echo ' ' && mysql --version ;;
|
9|v|V) apachectl -v && echo ' ' && php -v && echo ' ' && echo "$v_php_apache (Apache)" && echo ' ' && mysql --version ;;
|
||||||
10|c|C) echo -e "\033[4mApache:\033[0m " && echo $v_apa && echo ' ' && echo -e "\033[4mPHP:\033[0m " && echo $v_php && echo ' ' && echo -e "\033[4mMySQL:\033[0m " && echo $v_mysql ;;
|
10|c|C) echo -e "\033[4mApache:\033[0m " && echo $v_apa && echo ' ' && echo -e "\033[4mPHP:\033[0m " && echo "$v_php" && echo ' ' && echo -e "\033[4mMySQL:\033[0m " && echo $v_mysql ;;
|
||||||
11|w|W) read -e -n 3 -p "Which PHP version? (7.2/7.3/7.4): " choice
|
11|w|W) read -e -n 3 -p "Which PHP version? (7.3/7.4/8.0/8.1): " choice
|
||||||
# if [ "$choice" == "7.2" ] || [ "$choice" == "7.3" ] || [ "$choice" == "7.4" ]; then sphp "$choice" ; fi ;;
|
if [[ "$choice" == "7.3" ]] || [[ "$choice" == "7.4" ]] || [[ "$choice" == "8.0" ]] || [[ "$choice" == "8.1" ]]; then echo "$choice" | xargs -p -n 1 sphp ; fi ;;
|
||||||
# if [ "$choice" == "7.2" ] || [ "$choice" == "7.3" ] || [ "$choice" == "7.4" ]; then echo "$choice" | xargs -p -n 1 sphp ; fi ;;
|
#if [[ "$choice" == "7.3" ]] || [[ "$choice" == "7.4" ]] || [[ "$choice" == "8.0" ]]; then echo "$choice" | xargs -p -n 1 brew-php-switcher ; fi ;;
|
||||||
if [[ "$choice" == "7.2" ]] || [[ "$choice" == "7.3" ]] || [[ "$choice" == "7.4" ]]; then echo "$choice" | xargs -p -n 1 brew-php-switcher ; fi ;;
|
|
||||||
#12|u|U) curl -L 'https://gist.githubusercontent.com/rhukster/f4c04f1bf59e0b74e335ee5d186a98e2/raw' > /usr/local/bin/sphp && chmod +x /usr/local/bin/sphp ;;
|
#12|u|U) curl -L 'https://gist.githubusercontent.com/rhukster/f4c04f1bf59e0b74e335ee5d186a98e2/raw' > /usr/local/bin/sphp && chmod +x /usr/local/bin/sphp ;;
|
||||||
|
12|u|U) open 'https://gist.githubusercontent.com/rhukster/f4c04f1bf59e0b74e335ee5d186a98e2/raw' ;;
|
||||||
13|n|N) add_ini
|
13|n|N) add_ini
|
||||||
read -e -n 1 -p "Edit which file ?: " choice
|
read -e -n 1 -p "Edit which file ?: " choice
|
||||||
#if [[ "$choice" == 1 ]] || [[ "$choice" == 4 ]]; then "$editeur" ${additionnal[$choice]}; fi ;;
|
#if [[ "$choice" == 1 ]] || [[ "$choice" == 4 ]]; then "$editeur" ${additionnal[$choice]}; fi ;;
|
||||||
|
|||||||
@@ -159,15 +159,27 @@ done
|
|||||||
#
|
#
|
||||||
# Nettoyage serveurs locaux:
|
# Nettoyage serveurs locaux:
|
||||||
|
|
||||||
|
if find --version >/dev/null 2>&1 ; then
|
||||||
|
echo Using GNU date
|
||||||
|
d_duration="$BKP_DAYS"
|
||||||
|
w_duration="$BKP_DAYS"
|
||||||
|
m_duration="$BKP_DAYS"
|
||||||
|
else
|
||||||
|
echo Using BSD date
|
||||||
|
d_duration="$BKP_DAYS"d
|
||||||
|
w_duration="$BKP_DAYS"d
|
||||||
|
m_duration="$BKP_DAYS"d
|
||||||
|
fi
|
||||||
|
|
||||||
#find $BKP_DEST -name "*.sql.gz" -mtime +$BKP_DAYS | grep -v -E '(January|February|March|April|May|June|July|August|September|October|November|December)|(S\d{2}_\d{4})' | xargs rm -f
|
#find $BKP_DEST -name "*.sql.gz" -mtime +$BKP_DAYS | grep -v -E '(January|February|March|April|May|June|July|August|September|October|November|December)|(S\d{2}_\d{4})' | xargs rm -f
|
||||||
find $BKP_DEST -name "*.sql.gz" -mtime +"$BKP_DAYS"d | grep -v -E '(janvier|fevrier|mars|avril|mai|juin|juillet|aout|septembre|octobre|novembre|decembre)|(S\d{2}_\d{4})' | xargs rm -f
|
find $BKP_DEST -name "*.sql.gz" -mtime +"$d_duration" | grep -v -E '(janvier|fevrier|mars|avril|mai|juin|juillet|aout|septembre|octobre|novembre|decembre)|(S\d{2}_\d{4})' | xargs rm -f
|
||||||
##gfind /Users/bruno/Documents/MySQL -mtime +93 -iregex '.*\(January\|February\|March\|April\|May\|June\|July\|September\|October\|November\|December\).*'
|
##gfind /Users/bruno/Documents/MySQL -mtime +93 -iregex '.*\(January\|February\|March\|April\|May\|June\|July\|September\|October\|November\|December\).*'
|
||||||
|
|
||||||
find $BKP_DEST -name "*.sql.gz" -mtime +"$BKP_WEEKS"d | grep -E 'S\d{2}_\d{4}' | xargs rm -f
|
find $BKP_DEST -name "*.sql.gz" -mtime +"$w_duration" | grep -E 'S\d{2}_\d{4}' | xargs rm -f
|
||||||
##gfind /Users/bruno/Documents/MySQL -mtime +22 -regextype posix-extended -iregex '.*S[0-9]{2}_[0-9]{4}.*'
|
##gfind /Users/bruno/Documents/MySQL -mtime +22 -regextype posix-extended -iregex '.*S[0-9]{2}_[0-9]{4}.*'
|
||||||
|
|
||||||
#find $BKP_DEST -name "*.sql.gz" -mtime +$BKP_MONTHS | grep -E '(January|February|March|April|May|June|July|August|September|October|November|December)' | xargs rm -f
|
#find $BKP_DEST -name "*.sql.gz" -mtime +$BKP_MONTHS | grep -E '(January|February|March|April|May|June|July|August|September|October|November|December)' | xargs rm -f
|
||||||
find $BKP_DEST -name "*.sql.gz" -mtime +"$BKP_MONTHS"d | grep -E '(janvier|février|mars|avril|mai|juin|juillet|août|septembre|octobre|novembre|decembre)' | xargs rm -f
|
find $BKP_DEST -name "*.sql.gz" -mtime +"$m_duration" | grep -E '(janvier|février|mars|avril|mai|juin|juillet|août|septembre|octobre|novembre|decembre)' | xargs rm -f
|
||||||
#
|
#
|
||||||
|
|
||||||
# Nettoyage serveurs distants:
|
# Nettoyage serveurs distants:
|
||||||
|
|||||||
Reference in New Issue
Block a user