• The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Backup Manager automating tasks

Noturns

Regular Pleskian
I have setup Backup Manager to backup Files and Configurations every week for every subscription. This worked really good however we are now considering changing this to daily basis.

As the free space on server will decrease. I was wondering i there is any way with cronjobs how to remove the backup older than 24 weeks. Could anyone post an example on how to make such an cronjob script?

If possible i also would like to know where the Backup Manager physically stores its backups?

Thanks
 
Delete Files Older Than x Days on Linux

The find utility on linux allows you to pass in a bunch of interesting arguments, including one to execute another command on each file. We’ll use this in order to figure out what files are older than a certain number of days, and then use the rm command to delete them.

Command Syntax

Code:
find /path/to/files* -mtime +5 -exec rm {} \;

Note that there are spaces between rm, {}, and \;

Explanation
  • The first argument is the path to the files. This can be a path, a directory, or a wildcard as in the example above. I would recommend using the full path, and make sure that you run the command without the exec rm to make sure you are getting the right results.
  • The second argument, -mtime, is used to specify the number of days old that the file is. If you enter +5, it will find files older than 5 days.
  • The third argument, -exec, allows you to pass in a command such as rm. The {} \; at the end is required to end the command.
This should work on Ubuntu, Suse, Redhat, or pretty much any version of linux.
 
Great! Thanks for the fast response and information

edit: i now use two scripts that works with CentOS and inspects files without removing them

Check script (without removing)
# find /var/lib/psa/dumps/domains/* -mtime +128 -type f -exec ls -l {} \;

Execute script (removing)
# find /var/lib/psa/dumps/domains/* -mtime +128 -type f -print -exec rm {} \;
 
Last edited:
What is the correct way to execute an script as Cronjob (in Plesk) ?
If possible i want to know if its possible to call a cleanup.sh script

Because i have tried a cronjob with System User 'Bin' and 'Root' without any luck because they have no permission to run cleanup.sh script

I was able to run just a "find older than 128days" script without "remove file" parameter (through Scheduled tasks)

When the scheduled Task runs i have set to receive an email notification that the cronjob script has no permission.

I have placed this script in a new folder called CustomScripts (drwxr-xr-x 2 root root)
 
Last edited:
Solved

I created a new folder and moved my script to that folder
Do this golden tip: chmod +x /path/to/script

I also noticed in the script on the server a + symbol was missing therefor was not looking only for files exactly 128 days old ;-)

Always make sure it your scheduled task runs as the appropriate System User.
 
Back
Top