Page 1 of 1

cron is re-writing my delete cache command?

Posted: Mon Jun 03, 2019 5:02 pm
by viraladmin
So I am trying to add the following command as a cron job:

Code: Select all

find /home/*/tmp -type f -name 'sess_*' -cmin +60 -delete
The problem is for some reason, vesta is rewriting the command....

so upon saving, instead of the command above, it is saving

Code: Select all

find /home/admin/tmp /home/user1/tmp /home/user2/tmp /home/user3/tmp /home/user4/tmp /home/user5/tmp -type f -name 'sess_*' -cmin +60 -delete
Note that user1, user2, user3, user4, user5 are actually the user names of accounts.

This is obviously a problem as when more users are added, they would not be automatically included in the command - because its not saving as /home/*/tmp

Is this a bug? Is there a work around other than updating the cron every time a new user is added?

Re: cron is re-writing my delete cache command?

Posted: Tue Jun 04, 2019 3:56 pm
by skamasle

Vesta have some with asterisk, not remember when but I see similar issue

You can try just not add a cron with full command, vesta parsewith php somethings and is not good if you have complex simbols

You just can fix this addking new file

For example:


Inside that file add your command

Code: Select all

find /home/*/tmp -type f -name 'sess_*' -cmin +60 -delete
chmod +x /usr/local/bin/

And then add your cron :


I think always this is the best way to create new crons with some complex operations, long scripts, special characters