Problem with cron job

Discussion in 'Installation/Configuration' started by GeorgeG, Sep 16, 2013.

  1. GeorgeG

    GeorgeG New Member

    Hello All,

    I have created a web application that under specific conditions will create debug files in a folder within the web folder. For argument's sake the actual folder name is "/var/www/clients/client0/web1/web/DEBUG"

    I want these files to be available to the user, so they can do their checks, but I don't want files to lurk there forever.

    I have created a cron job via the ISPConfig GUI, to delete all the files that are older than 10 minutes, every 30 minutes.

    Effectively the cron job looks like:

    0,30 * * * * web1 /var/www/clients/client0/web1/find /var/www/clients/client0/web1/web/DEBUG/*.DEBUG -type f -mmin +10 -exec rm {} \;

    The cron job seems to be executed, I can see the entry in "/var/log/syslog" but the files don't get deleted.
    Note: There is no error in /var/log/syslog.

    I am running ISPConfig v3.0.5 on Ubuntu Server.

    The particular client runs php-fpm (if that is related).

  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Is the find command really in that place?


    If not, then specify its full path (e.g. /usr/bin/find or whereever it is located on your system) in the command field in ispconfig. In cronjobs, you have to use the full path for commands as the $PATH variable is not set there.
  3. GeorgeG

    GeorgeG New Member

    Hello Till and all,

    Yes that would make sense...

    I modified the cron job to:
    0,15,30,45 * * * * web1 /usr/bin/find /var/www/clients/client0/web1/web/DEBUG/*.DEBUG -type f -mmin +10 -exec rm {} \;

    But the files do not get deleted...

    the content of the directoy is:

    total 72
    drwxr-x--- 2 web1 client0 4096 Sep 17 16:00 .
    drwx--x--- 7 web1 client0 4096 Sep 17 07:32 ..
    -rw-r--r-- 1 web1 client0 10518 Sep 17 15:29 ws_110.DEBUG
    -rw-r--r-- 1 web1 client0 10620 Sep 17 16:00 ws_112.DEBUG
    -rw-r--r-- 1 web1 client0 3612 Sep 16 18:23 ws_80.DEBUG
    -rw-r--r-- 1 web1 client0 10612 Sep 17 11:33 ws_91.DEBUG
    -rw-r--r-- 1 web1 client0 3615 Sep 16 18:23 ws_92.DEBUG
    -rw-r--r-- 1 web1 client0 3301 Sep 17 10:57 ws_93.DEBUG
    -rw-r--r-- 1 web1 client0 3353 Sep 17 11:07 ws_94.DEBUG
    -rw-r--r-- 1 web1 client0 10563 Sep 17 14:12 ws_96.DEBUG

    The result of "/usr/bin/find /var/www/clients/client0/web1/web/DEBUG/*.DEBUG -type f -mmin +10" when run from the command line is:


    Looking at "/etc/cron.d/ispc_chrooted_web1" it looks like:

    0,15,30,45 * * * * web1 /usr/bin/find /var/www/clients/client0/web1/web/DEBUG/*.DEBUG -type f -mmin +10 -exec rm {} \;

    Any suggestions?


Share This Page