Cron Job on Ubuntu Hardy Executing But Not Deleting Files As Expected
        Posted  
        
            by Patrick McKenzie
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Patrick McKenzie
        
        
        
        Published on 2009-05-24T15:43:30Z
        Indexed on 
            2010/05/09
            4:38 UTC
        
        
        Read the original article
        Hit count: 553
        
I have a bit of a pickle here and wonder if anyone can give me some pointers:
I have a cron job which executes for a particular user daily and is supposed to sweep files in a particular directory. Technically, it is two jobs. I've turned on cron.log to verify they're actually executing, and they are:
May 24 11:03:01 AppNameGoesHere /USR/SBIN/CRON[11257]: (mongrel_AppNameGoesHere) 
  CMD (rm -rf /var/www/apps/AppNameGoesHere/current/public/
  {popular,index,purchasing,purchasing-alternate,support,about-us,guarantee,screenshots}.htm{,l})
May 24 11:04:01 AppNameGoesHere /USR/SBIN/CRON[11260]: (mongrel_AppNameGoesHere)
  CMD (rm -rf /var/www/apps/AppNameGoesHere/current/public/
  {stats,popular,bcf,articles,expenses})
I have removed the actual usernames and formatted it so that it is less ugly on StackOverflow.
Now, my question: Despite the fact that I can see these deletions executing and apparently succeeding in the log, if I go to the specified directory, the files are still there. I initially suspected permission hijinx were going on, but I've verified that I can delete the files manually by su-ing into the mongrel_AppNameGoesHere user and issuing individual rm commands or by copy/pasting the cron job to the command line. Anything that I don't manually zap stays unzapped despite days of that cron job executing successfully.
Any suggestions on to what might be happening?  I was previously using Dapper Drake with these cron jobs in the /etc/crontab file directly, and when I upgraded to Hardy I moved them to user-specific crontabs (via sudo crontab -e - u mongrel_AppNameGoesHere), which was the point where they appear to have stopped working.)
© Stack Overflow or respective owner