Vesta Control Panel - Forum

Community Forum

Skip to content

Advanced search
  • Quick links
    • Main site
    • Github repo
    • Google Search
  • FAQ
  • Login
  • Register
  • Board index Main Section General Discussion
  • Search

cron is re-writing my delete cache command?

General questions about VestaCP
Post Reply
  • Print view
Advanced search
2 posts • Page 1 of 1
viraladmin
Posts: 57
Joined: Thu Apr 27, 2017 7:40 pm

Os: Ubuntu 15x
Web: apache + nginx
cron is re-writing my delete cache command?
  • Quote

Post by viraladmin » Mon Jun 03, 2019 5:02 pm

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?
Top

skamasle
Collaborator
Posts: 592
Joined: Mon Feb 29, 2016 6:36 pm

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

Post by skamasle » Tue Jun 04, 2019 3:56 pm

HI

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:

/usr/local/bin/fix_ses.sh

Inside that file add your command

Code: Select all

#!/bin/bash
find /home/*/tmp -type f -name 'sess_*' -cmin +60 -delete
chmod +x /usr/local/bin/fix_ses.sh

And then add your cron :

/usr/local/bin/fix_ses.sh

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


Post Reply
  • Print view

2 posts • Page 1 of 1

Return to “General Discussion”



  • Board index
  • All times are UTC
  • Delete all board cookies
  • The team
Powered by phpBB® Forum Software © phpBB Limited
*Original Author: Brad Veryard
*Updated to 3.2 by MannixMD
 

 

Login  •  Register

I forgot my password