From e170f7294779491f30a6e0e0dc5ba5b3b433b608 Mon Sep 17 00:00:00 2001 From: caskd Date: Mon, 1 Apr 2019 00:05:30 +0200 Subject: [PATCH] Fixed leftover wrong formats --- plugins/docker/main.sh | 20 ++++++++++---------- plugins/maintenance/main.sh | 6 +++--- plugins/pterodactyl/main.sh | 14 +++++++------- plugins/rclone-sync/main.sh | 4 ++++ 4 files changed, 24 insertions(+), 20 deletions(-) create mode 100644 plugins/rclone-sync/main.sh diff --git a/plugins/docker/main.sh b/plugins/docker/main.sh index dc6c621..ff7081e 100644 --- a/plugins/docker/main.sh +++ b/plugins/docker/main.sh @@ -6,37 +6,37 @@ for i in "${containers[@]}"; do case "$2" in "start") if (( $(echo "${dockercont}" | grep -c "$i") > 0 )); then - output "warn Container $i was already up and running!" + echo "warn Container $i was already up and running!" else if (docker start "$i" > /dev/null 2>&1); then - output "done Started container $i succesfully!" + echo "done Started container $i succesfully!" else - output "erro Failed to start container $i!" + echo "erro Failed to start container $i!" fi fi ;; "stop") if (( $(echo "${dockercont}" | grep -c "$i") > 0 )); then if (docker stop --time=20 "$i" > /dev/null 2>&1); then - output "done Stopped container $i succesfully!" + echo "done Stopped container $i succesfully!" else - output "erro Failed to stop container $i!" + echo "erro Failed to stop container $i!" fi else - output "warn Container $i was already stopped!" + echo "warn Container $i was already stopped!" fi ;; "status") if (( $(echo "${dockercont}" | grep -c "$i") > 0 )); then - output "warn Container $i is up and running!" + echo "warn Container $i is up and running!" else - output "erro Container $i is stopped!" + echo "erro Container $i is stopped!" fi ;; esac elif (systemctl -q is-active docker); then - output "erro An error has occured, we are sorry!" + echo "erro An error has occured, we are sorry!" else - output "erro Docker is stopped, cannot perform check!" + echo "erro Docker is stopped, cannot perform check!" fi done diff --git a/plugins/maintenance/main.sh b/plugins/maintenance/main.sh index 42d01f5..f2ecf42 100644 --- a/plugins/maintenance/main.sh +++ b/plugins/maintenance/main.sh @@ -1,17 +1,17 @@ if [ -x "$(command -v docker)" ]; then - output "info Clearing Docker remainings" + echo "info Clearing Docker remainings" docker system prune --all -f fi case $(uname -rv) in *Ubuntu*) - output "info Clearing & Updating APT" + echo "info Clearing & Updating APT" apt-get -y update apt-get -y autoclean apt-get -y autoremove ;; esac -output "info Clearing logs" +echo "info Clearing logs" if [ -x "$(command -v nginx)" ]; then truncate -s 0 "${LOGPATH:-/var/log/nginx/*.*}" fi diff --git a/plugins/pterodactyl/main.sh b/plugins/pterodactyl/main.sh index 4840be2..83727d1 100644 --- a/plugins/pterodactyl/main.sh +++ b/plugins/pterodactyl/main.sh @@ -2,14 +2,14 @@ case "$2" in "update") cd /var/www/pterodactyl || exit php artisan down - output "info Fetching latest releases" + echo "info Fetching latest releases" curl -L https://github.com/pterodactyl/panel/releases/download/"$(getlatest "Pterodactyl/panel")"/panel.tar.gz | tar --strip-components=1 -xzv curl -L https://github.com/RXCommunity/RedXen-Panel/archive/"$(getlatest "RXCommunity/RedXen-Panel")".tar.gz | tar --strip-components=1 -xzv - output "info Ensuring permissions are correct" + echo "info Ensuring permissions are correct" chown -R www-data:www-data ./* chmod -R 755 storage/* bootstrap/cache - output "info Getting latest deps" - composer install --no-dev --optimize-autoloader || output "erro Failed to get deps!" + echo "info Getting latest deps" + composer install --no-dev --optimize-autoloader || echo "erro Failed to get deps!" artisanfunc=( "view:clear" @@ -21,10 +21,10 @@ case "$2" in "up" ) - output "info Running migrations and clearance" + echo "info Running migrations and clearance" for f in "${artisanfunc[@]}"; do - php artisan $f || output "erro Failed to execute 'artisan ${f}'" + php artisan $f || echo "erro Failed to execute 'artisan ${f}'" done ;; - *); echo "Nothing to do";; + *); echo "warn Nothing to do";; esac diff --git a/plugins/rclone-sync/main.sh b/plugins/rclone-sync/main.sh new file mode 100644 index 0000000..138b6b1 --- /dev/null +++ b/plugins/rclone-sync/main.sh @@ -0,0 +1,4 @@ +for i in ${#DIRS[@]}; do + echo "info" "Syncing ${DIRS[$I]##*${DELIMIT}} with ${DIRS[$I]%%${DELIMIT}*}" + (rclone sync -P ${DIRS[$I]%%${DELIMIT}*} ${DIRS[$I]##*${DELIMIT}}) > /dev/null 2>&1 +done