From b7b3fed44572f7c98b63a199c8dd2a4faa17ff00 Mon Sep 17 00:00:00 2001 From: Christoph Date: Mon, 25 Sep 2017 00:13:47 +0200 Subject: [PATCH] Flush redis cache and restart redis server after nextcloud is updated. --- update_nextcloud.sh | 43 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/update_nextcloud.sh b/update_nextcloud.sh index b47a5a5..5ddbbc1 100755 --- a/update_nextcloud.sh +++ b/update_nextcloud.sh @@ -655,7 +655,7 @@ fi # - echo "" echo " Update Nextcloud" -su -c"/usr/local/php/bin/php ${WEB_BASE_DIR}/htdocs/occ upgrade" -s /bin/bash $HTTP_USER > $log_file 2>&1 +su -c"/usr/local/php/bin/php ${WEB_BASE_DIR}/htdocs/occ upgrade" -s /bin/bash $HTTP_USER if [[ $? -eq 0 ]]; then echo_ok else @@ -714,6 +714,47 @@ else warn "The webserver was not running, so it will be keept down!" fi +_redis_cli_bin="$(which redis-cli)" +if [[ -z "$_redis_cli_bin" ]]; then + if [[ -x "/usr/local/bin/redis-cli" ]]; then + _redis_cli_bin="/usr/local/bin/redis-cli" + fi +fi + + +echononl " Flush redis cache.." +if [[ -x "$_redis_cli_bin" ]]; then + $_redis_cli_bin flushall > $log_file 2>&1 + if [[ $? -eq 0 ]]; then + echo_ok + else + echo_failed + error "$(cat $log_file)" + fi +else + echo_skipped +fi + + +echononl " Restart redis server.." +if $SYSTEMD_EXISTS ; then + systemctl restart redis-server > $log_file 2>&1 + if [[ $? -eq 0 ]]; then + echo_ok + else + echo_failed + error "$(cat $log_file)" + fi +else + /etc/init.d/redis-server restart > $log_file 2>&1 + if [[ $? -eq 0 ]]; then + echo_ok + else + echo_failed + error "$(cat $log_file)" + fi +fi + echononl " Install previously saved crontab from '$_backup_crontab_file'.." crontab $_backup_crontab_file > $log_file 2>&1