skip to Main Content

Because I am always running out of space, I want to delete several zip files automatically by creating a cron job in Plesk. I did some research, but apparently I am doing something wrong, because nothing is happening.

Running Plesk 12.

Here is the cron job I am currently trying to use:

/usr/bin/find /var/www/vhosts/sitename.com/httpdocs/backups/ -type f -name '*.zip' -mtime +2 -exec rm {} ;

What am I doing wrong here?

Thank you in advance.

//update

I took a look at the link that michael posted and changed my cron job to:

find /var/www/vhosts/sitename.com/httpdocs/backups/ -type f -mtime +2 -name '*.zip' -execdir rm -- {} ;

But still no dice. It doesn’t remove the .zip files. Sigh. This should have worked right?

2

Answers


  1. Chosen as BEST ANSWER

    Well I didn't make a mistake with the cron job, but I had to change the following setting:

    Access to the server over SSH
    

    from

    bin/bash (chrooted)
    

    to

    /bin/sh
    

    That fixed everything for me. Now the cron job is working.

    So people experiencing this problem and are on Plesk 12, should do the above to fix problems with their cron jobs.


  2. Just create corresponding bash script with this command and run this script as cron job.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search