Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save minhazulOO7/0d83f4f2ee69e2edcf58300d168d38ae to your computer and use it in GitHub Desktop.
Save minhazulOO7/0d83f4f2ee69e2edcf58300d168d38ae to your computer and use it in GitHub Desktop.
Shell Scripts to Copy/ Move CyberPanel Backup Archive(s)

Copy/ Move CyberPanel Backup Archive(s) using Bash Script with/ without Crontab/ Systemd Timer

  • NO LONGER MAINTAINED!
  • These scripts will copy/ move CyberPanel backup archive(s) from /home/domain/backup directory to a specified directory by the user.

Script Requirements

How to Use it?

  1. There are two scripts to work with. One is cpbac_a.sh another one is cpbac_m.sh. If you want to use it with crontab/ systemd timer then cpbac_a.sh is suitable for you. If you want to use it manually with prompt (running it by yourself) then cpbac_m.sh is suitable for you.

  2. If you want to use cpbac_a.sh then put the cpbac_a.sh file to anyhwere you like. E.g., /home/scripts.

  • Open terminal.
  • Give the file execute permission, type/ copy sudo chmod +x /location/cpbac_a.sh press Enter.
  • For executing the script, type/ copy /location/cpbac_a.sh press Enter.
  • REMEMBER! cpbac_a.sh is suitable for crontab/ systemd timer!.

For crontab:

  • Open terminal.
  • Give the file execute permission, type/ copy sudo chmod +x /location/cpbac_a.sh press Enter.
  • Open crontab, type/ copy crontab -e press Enter.
  • If you want to run the job every day at 12AM, type/ copy 0 0 * * * /location/cpbac_a.sh.
  • If you want to run the job every day at 12PM, type/ copy 0 12 * * * /location/cpbac_a.sh.
  • If you want more time flexibility then goto this link.
  • After setting cron press Esc and type wq then press Enter.
  • Setting up cron is completed!

For systemd timer:

  • Open terminal.
  • Give the file execute permission, type/ copy sudo chmod +x /location/cpbac_a.sh press Enter.
  • Create a systemd service unit, type/ copy /etc/systemd/system/cpbac_a.service press Enter.
  • Copy all of the content from cpbac_a.service down below.
  • After setting service unit press Esc and type wq then press Enter.
  • Create a systemd timer unit at the same location of service unit, type/ copy /etc/systemd/system/cpbac_a.timer press Enter.
  • Copy all of the content from cpbac_a.timer down below.
  • If you want to run the timer unit every day at 12AM, edit/ copy *-*-* 00:00:00 (This is given on the cpbac_a.timer file).
  • If you want to run the timer unit every day at 12PM, edit/ copy *-*-* 12:00:00.
  • If you want more time flexibility then goto this link.
  • After setting timer unit press Esc and type wq then press Enter.
  • Reload systemd, type/ copy sudo systemctl daemon-reload.
  • Enable timer unit, type/ copy sudo systemctl enable cpbac_a.timer.
  • Start timer unit, type/ copy sudo systemctl start cpbac_a.timer.
  • Setting up systemd timer is completed!
  1. If you want to use cpbac_m.sh then put the cpbac_m.sh file to anyhwere you like. E.g., /home/scripts.
  • Open terminal.
  • Give the file execute permission, type/ copy sudo chmod +x /location/cpbac_m.sh press Enter.
  • For executing the script, type/ copy /location/cpbac_m.sh press Enter.
  • REMEMBER! cpbac_m.sh is not suitable for crontab/ systemd timer!.

How it Works?

This is a verbal representation of the script explaining how the script works.

Steps:

For cpbac_a.sh:

  1. Script will start executing and shows [CyberPanel BAC] BACKUP ARCHIVE(S) COPIER/ MOVER INITIATED....

  2. Now it will check for LOGGED IN AS ROOT and shows [CyberPanel BAC] CHECKING IF LOGGED IN AS ROOT....

  • If user is root then it will show [CyberPanel BAC] LOGGED IN AS ROOT! and go to next step.
  • If user is not root then it will show [CyberPanel BAC] NOT LOGGED IN AS ROOT!, [CyberPanel BAC] YOU MUST BE LOGGED IN AS ROOT! and exit.
  1. Now it will find BACKUP ARCHIVE(S) and shows [CyberPanel BAC] FINDING BACKUP ARCHIVE(S)....
  • If it finds any BACKUP ARCHIVE(S) then it will show [CyberPanel BAC] BACKUP ARCHIVE(S) FOUND! and go to next step.
  • If it does not finds any BACKUP ARCHIVE(S) then it will show [CyberPanel BAC] NO BACKUP ARCHIVE(S) FOUND!, [CyberPanel BAC] CREATE BACKUP ARCHIVE(S) AT 'IP or domain:8090/backup/backupSite' THEN TRY AGAIN! and exit.
  1. Now it will check for action value.
  • REMEMBER! IT WILL OVERWRITE ANY FILE ON DESTINATION DIRECTORY IF NAME IS MATCHED! YOU HAVE BEEN WARNED!

For copy:

  • If action value is set to c, C and destination directory is available then it will copy and shows [CyberPanel BAC] COPY IS ENABLED!, [CyberPanel BAC] DESTINATION DIRECTORY FOUND!, [CyberPanel BAC] COPYING BACKUP ARCHIVE(S)..., [CyberPanel BAC] LISTING COPIED BACKUP ARCHIVE(S), [CyberPanel BAC] COPYING ARCHIVE(S) COMPLETED!, [CyberPanel BAC] YOU WILL FIND BACKUP ARCHIVE(S) AT '/cp_sites_backups' DIRECTORY! and exit.

  • If action value is set to c, C and destination directory is not available then it will copy and shows [CyberPanel BAC] COPY IS ENABLED!, [CyberPanel BAC] DESTINATION DIRECTORY NOT FOUND!, [CyberPanel BAC] CREATING DIRECTORY..., [CyberPanel BAC] DIRECTORY CREATED AT '/cp_sites_backups'!, [CyberPanel BAC] COPYING BACKUP ARCHIVE(S)..., [CyberPanel BAC] LISTING COPIED BACKUP ARCHIVE(S), [CyberPanel BAC] COPYING ARCHIVE(S) COMPLETED!, [CyberPanel BAC] YOU WILL FIND BACKUP ARCHIVE(S) AT '/cp_sites_backups' DIRECTORY! and exit.

For move:

  • If action value is set to m, M and destination directory is available then it will move and shows [CyberPanel BAC] MOVE IS ENABLED!, [CyberPanel BAC] MOVING BACKUP ARCHIVE(S)..., [CyberPanel BAC] LISTING MOVED BACKUP ARCHIVE(S), [CyberPanel BAC] MOVING ARCHIVE(S) COMPLETED!, [CyberPanel BAC] YOU WILL FIND BACKUP ARCHIVE(S) AT '/cp_sites_backups' DIRECTORY! and exit.

  • If action value is set to m, M and destination directory is not available then it will move and shows [CyberPanel BAC] MOVE IS ENABLED!, [CyberPanel BAC] DIRECTORY NOT FOUND!, [CyberPanel BAC] CREATING DIRECTORY..., [CyberPanel BAC] DIRECTORY CREATED AT '/cp_sites_backups'!, [CyberPanel BAC] MOVING BACKUP ARCHIVE(S)..., [CyberPanel BAC] LISTING MOVED BACKUP ARCHIVE(S), [CyberPanel BAC] MOVING ARCHIVE(S) COMPLETED!, [CyberPanel BAC] YOU WILL FIND BACKUP ARCHIVE(S) AT '/cp_sites_backups' DIRECTORY! and exit.

  1. If action value is not c, C, m, M then it will show [CyberPanel BAC] INVALID ACTION VALUE! and exit.

For cpbac_m.sh:

  1. Script will start executing and shows [CyberPanel BAC] BACKUP ARCHIVE(S) COPIER/ MOVER INITIATED....

  2. Now it will check for LOGGED IN AS ROOT and shows [CyberPanel BAC] CHECKING IF LOGGED IN AS ROOT....

  • If user is root then it will show [CyberPanel BAC] LOGGED IN AS ROOT! and go to next step.
  • If user is not root then it will show [CyberPanel BAC] NOT LOGGED IN AS ROOT!, [CyberPanel BAC] YOU MUST BE LOGGED IN AS ROOT! and exit.
  1. Now it will find BACKUP ARCHIVE(S) and shows [CyberPanel BAC] FINDING BACKUP ARCHIVE(S)....
  • If it finds any BACKUP ARCHIVE(S) then it will show [CyberPanel BAC] BACKUP ARCHIVE(S) FOUND! and go to next step.
  • If it does not finds any BACKUP ARCHIVE(S) then it will show [CyberPanel BAC] NO BACKUP ARCHIVE(S) FOUND!, [CyberPanel BAC] CREATE BACKUP ARCHIVE(S) AT 'IP or domain:8090/backup/backupSite' THEN TRY AGAIN! and exit.
  1. Now it will show a prompt [CyberPanel BAC] DO YOU WANT TO COPY/ MOVE BACKUP ARCHIVE(S) (c/m)?.
  • REMEMBER! IT WILL OVERWRITE ANY FILE ON DESTINATION DIRECTORY IF NAME IS MATCHED! YOU HAVE BEEN WARNED!

For copy:

  • If user types c, C then it will show another prompt [CyberPanel BAC] ARE YOU SURE (y/n)?.

  • If user types y, Y and destination directory is available then copy function will be executed and shows [CyberPanel BAC] DESTINATION DIRECTORY FOUND!, [CyberPanel BAC] COPYING BACKUP ARCHIVE(S)..., [CyberPanel BAC] LISTING COPIED BACKUP ARCHIVE(S), [CyberPanel BAC] COPYING ARCHIVE(S) COMPLETED!, [CyberPanel BAC] YOU WILL FIND BACKUP ARCHIVE(S) AT '/cp_sites_backups' DIRECTORY! and exit.

  • If user types n, N then it will exit.

  • If user types something other than y, Y, n, N then it will show [CyberPanel BAC] INVALID INPUT! and exit.

  • If user types y, Y and destination directory is not available then copy function will be executed and shows [CyberPanel BAC] DESTINATION DIRECTORY NOT FOUND!, [CyberPanel BAC] CREATING DIRECTORY..., [CyberPanel BAC] DIRECTORY CREATED AT '/cp_sites_backups'!, [CyberPanel BAC] COPYING BACKUP ARCHIVE(S)..., [CyberPanel BAC] LISTING COPIED BACKUP ARCHIVE(S), [CyberPanel BAC] COPYING ARCHIVE(S) COMPLETED!, [CyberPanel BAC] YOU WILL FIND BACKUP ARCHIVE(S) AT '/cp_sites_backups' DIRECTORY! and exit.

  • If user types n, N then it will exit.

  • If user types something other than y, Y, n, N then it will show [CyberPanel BAC] INVALID INPUT! and exit.

For move:

  • If user types m, M then it will show another prompt [CyberPanel BAC] ARE YOU SURE (y/n)?.

  • If user types y, Y and backup directory is available then move function will be executed and shows [CyberPanel BAC] MOVING BACKUP ARCHIVE(S)..., [CyberPanel BAC] LISTING MOVED BACKUP ARCHIVE(S), [CyberPanel BAC] MOVING ARCHIVE(S) COMPLETED!, [CyberPanel BAC] YOU WILL FIND BACKUP ARCHIVE(S) AT '/cp_sites_backups' DIRECTORY! and exit.

  • If user types n, N then it will exit.

  • If user types something other than y, Y, n, N in the second prompt then it will show [CyberPanel BAC] INVALID INPUT! and exit.

  • If user types y, Y and backup directory is not available then move function will be executed and shows [CyberPanel BAC] DIRECTORY NOT FOUND!, [CyberPanel BAC] CREATING DIRECTORY..., [CyberPanel BAC] DIRECTORY CREATED AT '/cp_sites_backups'!, [CyberPanel BAC] MOVING BACKUP ARCHIVE(S)..., [CyberPanel BAC] LISTING MOVED BACKUP ARCHIVE(S), [CyberPanel BAC] MOVING ARCHIVE(S) COMPLETED!, [CyberPanel BAC] YOU WILL FIND BACKUP ARCHIVE(S) AT '/cp_sites_backups' DIRECTORY! and exit.

  • If user types n, N then it will exit.

  • If user types something other than y, Y, n, N in the second prompt then it will show [CyberPanel BAC] INVALID INPUT! and exit.

  • If user types something other than c, C, m, M in the first prompt then it will show [CyberPanel BAC] INVALID INPUT! and exit.

Notes

  • I have written the instructions based on CentOS 7.6.x.
  • Files name are started with 0, 1, 2, 3, 4 because of orderly manner.
  • I am new to this Scripting Business that's why if I made any mistake please point out any issue!
  • I will update it frequently!
[Unit]
Description=CyberPanel BAC A Service
After=network.target
[Service]
Type=oneshot
StandardOutput=null # journalctl will not output debug message
StandardError=journal # journalctl will only output error message
ExecStart=/location/cpbac_a.sh
[Install]
WantedBy=multi-user.target
[Unit]
Description=CyberPanel BAC A Timer
[Timer]
OnCalendar=*-*-* 00:00:00
Persistent=true
[Install]
WantedBy=timers.target
#!/bin/bash
# SETTINGS
dir_dst="/cp_sites_backups" # Default des. dir. loc. will be this. If you want to change it just replace it with any dir. loc..
action="c" # Default action is copy "c". If you want to move then change it to "m". You can also use "C" or "M".
# COMMANDS (DO NOT EDIT ANY COMMAND FROM HERE!)
find="find"
find_src="/home/*/backup/"
find_src_opt="-name"
find_src_ext="*.tar.gz"
url="IP or domain:8090/backup/backupSite"
cd="cd"
mkdir="mkdir $dir_dst"
cp="cp -a -v"
cp_src_="/home/*/backup/"
cp_src_ext="*.tar.gz"
cp_dst="$dir_dst"
ls_cp="ls -lh -s --color=auto $cp_dst"
mv="mv -v"
mv_src_="/home/*/backup/"
mv_src_ext="*.tar.gz"
mv_dst="$dir_dst"
ls_mv="ls -lh -s --color=auto $mv_dst"
# SCRIPT START
echo -e "\n[CyberPanel BAC] BACKUP ARCHIVE(S) COPIER/ MOVER INITIATED...\n"
# CHECK IF USER IS ROOT
echo -e "[CyberPanel BAC] CHECKING IF LOGGED IN AS ROOT..."
whoami=$(whoami)
if [[ $whoami == root ]];
then
echo -e "[CyberPanel BAC] LOGGED IN AS ROOT!\n"
else
echo "[CyberPanel BAC] NOT LOGGED IN AS ROOT!"
echo "[CyberPanel BAC] YOU MUST BE LOGGED IN AS ROOT!"
echo -e "[CyberPanel BAC] EXITING...\n"
exit 1
fi
# FIND BACKUP ARCHIVE(S)
echo "[CyberPanel BAC] FINDING BACKUP ARCHIVE(S)..."
find_rv=$($find $find_src $find_src_opt "$find_src_ext")
if [[ -z $find_rv ]];
then
echo "[CyberPanel BAC] NO BACKUP ARCHIVE(S) FOUND!"
echo "[CyberPanel BAC] CREATE BACKUP ARCHIVE(S) AT '$url' THEN TRY AGAIN!"
echo -e "[CyberPanel BAC] EXITING...\n"
exit 1
else
echo -e "[CyberPanel BAC] BACKUP ARCHIVE(S) FOUND!\n"
fi
# CHECK FOR ACTION VALUE
if [[ $action == [cC] ]];
then
echo -e "[CyberPanel BAC] COPY IS ENABLED!\n"
else
if [[ $action == [mM] ]];
then
echo -e "[CyberPanel BAC] MOVE IS ENABLED!\n"
else
if [[ $action != [cCmM] ]];
then
echo "[CyberPanel BAC] INVALID ACTION VALUE!"
echo -e "[CyberPanel BAC] EXITING...\n"
exit 1
fi
fi
fi
# COPY BACKUP ARCHIVE(S)
if [[ $action == [cC] ]];
then
if [[ -d $dir_dst ]];
then
echo -e "[CyberPanel BAC] DESTINATION DIRECTORY FOUND!\n"
echo -e "[CyberPanel BAC] COPYING BACKUP ARCHIVE(S)...\n"
$cp $cp_src_$cp_src_ext $cp_dst
echo -e "\n[CyberPanel BAC] LISTING COPIED BACKUP ARCHIVE(S)...\n"
$ls_cp
echo -e "\n[CyberPanel BAC] COPYING ARCHIVE(S) COMPLETED!\n"
echo "[CyberPanel BAC] YOU WILL FIND BACKUP ARCHIVE(S) AT '$dir_dst' DIRECTORY!"
echo -e "[CyberPanel BAC] EXITING...\n"
exit 0
else
if [[ ! -d $dir_dst ]];
then
echo "[CyberPanel BAC] DESTINATION DIRECTORY NOT FOUND!"
echo "[CyberPanel BAC] CREATING DIRECTORY..."
$cd
$mkdir
echo -e "[CyberPanel BAC] DIRECTORY CREATED AT '$dir_dst'!\n"
echo -e "[CyberPanel BAC] COPYING BACKUP ARCHIVE(S)...\n"
$cp $cp_src_$cp_src_ext $cp_dst
echo -e "\n[CyberPanel BAC] LISTING COPIED BACKUP ARCHIVE(S)...\n"
$ls_cp
echo -e "\n[CyberPanel BAC] COPYING ARCHIVE(S) COMPLETED!\n"
echo "[CyberPanel BAC] YOU WILL FIND BACKUP ARCHIVE(S) AT '$dir_dst' DIRECTORY!"
echo -e "[CyberPanel BAC] EXITING...\n"
exit 0
fi
fi
fi
# MOVE BACKUP ARCHIVE (S)
if [[ $action == [mM] ]];
then
if [[ -d $dir_dst ]];
then
echo -e "[CyberPanel BAC] DESTINATION DIRECTORY FOUND!\n"
echo -e "[CyberPanel BAC] MOVING BACKUP ARCHIVE(S)...\n"
$mv $mv_src_$mv_src_ext $mv_dst
echo -e "\n[CyberPanel BAC] LISTING MOVED BACKUP ARCHIVE(S)...\n"
$ls_mv
echo -e "\n[CyberPanel BAC] MOVING ARCHIVE(S) COMPLETED!\n"
echo "[CyberPanel BAC] YOU WILL FIND BACKUP ARCHIVE(S) AT '$dir_dst' DIRECTORY!"
echo -e "[CyberPanel BAC] EXITING...\n"
exit 0
else
if [[ ! -d $dir_dst ]];
then
echo "[CyberPanel BAC] DESTINATION DIRECTORY NOT FOUND!"
echo "[CyberPanel BAC] CREATING DIRECTORY..."
$cd
$mkdir
echo -e "[CyberPanel BAC] DIRECTORY CREATED AT '$dir_dst'!\n"
echo -e "[CyberPanel BAC] MOVING BACKUP ARCHIVE(S)...\n"
$mv $mv_src_$mv_src_ext $mv_dst
echo -e "\n[CyberPanel BAC] LISTING MOVED BACKUP ARCHIVE(S)...\n"
$ls_mv
echo -e "\n[CyberPanel BAC] MOVING ARCHIVE(S) COMPLETED!\n"
echo "[CyberPanel BAC] YOU WILL FIND BACKUP ARCHIVE(S) AT '$dir_dst' DIRECTORY!"
echo -e "[CyberPanel BAC] EXITING...\n"
exit 0
fi
fi
fi
#!/bin/bash
# SETTINGS
dir_dst="/cp_sites_backups" # Default des. dir. loc. will be this. If you want to change it just replace it with any dir. loc..
# COMMANDS (DO NOT EDIT ANY COMMAND FROM HERE!)
find="find"
find_src="/home/*/backup/"
find_src_opt="-name"
find_src_ext="*.tar.gz"
url="IP or domain:8090/backup/backupSite"
cd="cd"
mkdir="mkdir -v $dir_dst"
cp="cp -a -v"
cp_src_="/home/*/backup/"
cp_src_ext="*.tar.gz"
cp_dst="$dir_dst"
ls_cp="ls -lh -s --color=auto $cp_dst"
mv="mv -v"
mv_src_="/home/*/backup/"
mv_src_ext="*.tar.gz"
mv_dst="$dir_dst"
ls_mv="ls -lh -s --color=auto $mv_dst"
# SCRIPT START
echo -e "\n[CyberPanel BAC] BACKUP ARCHIVE(S) COPIER/ MOVER INITIATED...\n"
# CHECK IF USER IS ROOT
echo -e "[CyberPanel BAC] CHECKING IF LOGGED IN AS ROOT..."
whoami=$(whoami)
if [[ $whoami == root ]];
then
echo -e "[CyberPanel BAC] LOGGED IN AS ROOT!\n"
else
echo "[CyberPanel BAC] NOT LOGGED IN AS ROOT!"
echo "[CyberPanel BAC] YOU MUST BE LOGGED IN AS ROOT!"
echo -e "[CyberPanel BAC] EXITING...\n"
exit 1
fi
# FIND BACKUP ARCHIVE(S)
echo "[CyberPanel BAC] FINDING BACKUP ARCHIVE(S)..."
find_rv=$($find $find_src $find_src_opt "$find_src_ext")
if [[ -z $find_rv ]];
then
echo "[CyberPanel BAC] NO BACKUP ARCHIVE(S) FOUND!"
echo "[CyberPanel BAC] CREATE BACKUP ARCHIVE(S) AT '$url' THEN TRY AGAIN!"
echo -e "[CyberPanel BAC] EXITING...\n"
exit 1
else
echo -e "[CyberPanel BAC] BACKUP ARCHIVE(S) FOUND!\n"
fi
# PROMPT FOR OPTION
read -p "[CyberPanel BAC] DO YOU WANT TO COPY/ MOVE BACKUP ARCHIVE(S) (c/m)?"$'\n' -n 1 prompt
# COPY BACKUP ARCHIVE(S)
if [[ $prompt =~ [cC] ]];
then
echo
read -p "[CyberPanel BAC] ARE YOU SURE (y/n)?"$'\n' -n 1 prompt
if [[ $prompt =~ [yY] ]] && [[ -d $dir_dst ]];
then
echo -e "\n[CyberPanel BAC] DESTINATION DIRECTORY FOUND!\n"
echo -e "[CyberPanel BAC] COPYING BACKUP ARCHIVE(S)...\n"
$cp $cp_src_$cp_src_ext $cp_dst
echo -e "\n[CyberPanel BAC] LISTING COPIED BACKUP ARCHIVE(S)...\n"
$ls_cp
echo -e "\n[CyberPanel BAC] COPYING ARCHIVE(S) COMPLETED!\n"
echo "[CyberPanel BAC] YOU WILL FIND BACKUP ARCHIVE(S) AT '$dir_dst' DIRECTORY!"
echo -e "[CyberPanel BAC] EXITING...\n"
exit 0
else
if [[ $prompt =~ [yY] ]] && [[ ! -d $dir_dst ]];
then
echo -e "\n[CyberPanel BAC] DESTINATION DIRECTORY NOT FOUND!\n"
echo "[CyberPanel BAC] CREATING DIRECTORY..."
$cd
$mkdir
echo -e "[CyberPanel BAC] DIRECTORY CREATED AT '$dir_dst'!\n"
echo -e "[CyberPanel BAC] COPYING BACKUP ARCHIVE(S)...\n"
$cp $cp_src_$cp_src_ext $cp_dst
echo -e "\n[CyberPanel BAC] LISTING COPIED BACKUP ARCHIVE(S)...\n"
$ls_cp
echo -e "\n[CyberPanel BAC] COPYING ARCHIVE(S) COMPLETED!\n"
echo "[CyberPanel BAC] YOU WILL FIND BACKUP ARCHIVE(S) AT '$dir_dst' DIRECTORY!"
echo -e "[CyberPanel BAC] EXITING...\n"
exit 0
else
if [[ $prompt =~ [nN] ]];
then
echo -e "\n[CyberPanel BAC] EXITING...\n"
exit 0
else
# CHECK IF INVALID INPUT
if [[ $prompt != [yYnN] ]];
then
echo -e "\n[CyberPanel BAC] INVALID INPUT!"
echo -e "[CyberPanel BAC] EXITING...\n"
exit 1
fi
fi
fi
fi
fi
# MOVE BACKUP ARCHIVE (S)
if [[ $prompt =~ [mM] ]];
then
echo
read -p "[CyberPanel BAC] ARE YOU SURE (y/n)?"$'\n' -n 1 prompt
if [[ $prompt =~ [yY] ]] && [[ -d $dir_dst ]];
then
echo -e "\n[CyberPanel BAC] DESTINATION DIRECTORY FOUND!\n"
echo -e "[CyberPanel BAC] MOVING BACKUP ARCHIVE(S)...\n"
$mv $mv_src_$mv_src_ext $mv_dst
echo -e "\n[CyberPanel BAC] LISTING MOVED BACKUP ARCHIVE(S)...\n"
$ls_mv
echo -e "\n[CyberPanel BAC] MOVING ARCHIVE(S) COMPLETED!\n"
echo "[CyberPanel BAC] YOU WILL FIND BACKUP ARCHIVE(S) AT '$dir_dst' DIRECTORY!"
echo -e "[CyberPanel BAC] EXITING...\n"
exit 0
else
if [[ $prompt =~ [yY] ]] && [[ ! -d $dir_dst ]];
then
echo -e "\n[CyberPanel BAC] DESTINATION DIRECTORY NOT FOUND!"
echo "[CyberPanel BAC] CREATING DIRECTORY..."
$cd
$mkdir
echo -e "[CyberPanel BAC] DIRECTORY CREATED AT '$dir_dst'!\n"
echo -e "[CyberPanel BAC] MOVING BACKUP ARCHIVE(S)...\n"
$mv $mv_src_$mv_src_ext $mv_dst
echo -e "\n[CyberPanel BAC] LISTING MOVED BACKUP ARCHIVE(S)...\n"
$ls_mv
echo -e "\n[CyberPanel BAC] MOVING ARCHIVE(S) COMPLETED!\n"
echo "[CyberPanel BAC] YOU WILL FIND BACKUP ARCHIVE(S) AT '$dir_dst' DIRECTORY!"
echo -e "[CyberPanel BAC] EXITING...\n"
exit 0
else
if [[ $prompt =~ [nN] ]];
then
echo -e "\n[CyberPanel BAC] EXITING...\n"
exit 0
else
# CHECK IF INVALID INPUT
if [[ $prompt != [yYnN] ]];
then
echo -e "\n[CyberPanel BAC] INVALID INPUT!"
echo -e "[CyberPanel BAC] EXITING...\n"
exit 1
fi
fi
fi
fi
fi
# CHECK IF INVALID INPUT
if [[ $prompt != [cCmM] ]];
then
echo -e "\n[CyberPanel BAC] INVALID INPUT!"
echo -e "[CyberPanel BAC] EXITING...\n"
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment