Home » Linux » 10 November 2022 » » No Comment »

Simple shell script to check backup availability for Cpanel account

10 November 2022 No Comment
bash

I have write a simple shell script to show how many backup have been created for the account and listing the backup. The script is for my own use and my own note. I is very usefull if you have many backup and want simpler way to check the backup availability instead using WHM.

#!/bin/bash
# Shell script to check backup availability

echo ""
echo Shell script to check backup availability
read -p 'Username: ' username
echo There are
find /backup/*/*/accounts/ -maxdepth 1 -name $username* | wc -l
echo Backup available for $username
echo ""
echo Backup available for $username as below :
echo "Weekly"
ls -lath /backup/weekly/*/accounts/$username*
echo "Monthly"
ls -lath /backup/monthly/*/accounts/$username*


Output :
[root@wp4 backup]# ./backup-available.sh

Shell script to check backup availability
Username: inertz
There are
2
Backup available for inertz

Backup available for inertz as below :
Weekly
-rw------- 1 root root 3.6G Nov  5 10:47 /backup/weekly/2022-11-05/accounts/inertz.tar.gz
Monthly
-rw------- 1 root root 3.6G Oct 15 10:57 /backup/monthly/2022-10-15/accounts/inertz.tar.gz




Leave your response!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.