Command not working when run from cron [closed]

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite












I can successfully run this command in the terminal:



find /home/www/files/1 -type f -name '*' -mtime +180 -exec rm



However when I add it as a cron job like so:



*/5 * * * * find /home/www/files/1 -type f -name '*' -mtime +180 -exec rm



It doesn't work and the system sends a mail saying find: missing argument to '-exec'



What can I do to make it work as a cron task?







share|improve this question














closed as unclear what you're asking by Michael Homer, Jeff Schaller, jimmij, Rui F Ribeiro, meuh Jan 14 at 19:41


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.














  • use find like this /usr/bin/find in the cron
    – George Udosen
    Jan 14 at 1:01










  • Are you sure the first version is working? You appear to have a shell escape ` but no actual character (AFAIK it should be ; - or optionally + if your version of find supports it)
    – steeldriver
    Jan 14 at 1:02











  • Yes, the first command works as it's written. I will try adding /usr/bin/find now.
    – Dan P.
    Jan 14 at 1:03






  • 3




    Two additional notes: what do you think -name '*' accomplishes? Also, some versions of find support -delete.
    – dhag
    Jan 14 at 1:24






  • 2




    No, -name '*' is not needed
    – fpmurphy1
    Jan 14 at 1:47















up vote
1
down vote

favorite












I can successfully run this command in the terminal:



find /home/www/files/1 -type f -name '*' -mtime +180 -exec rm



However when I add it as a cron job like so:



*/5 * * * * find /home/www/files/1 -type f -name '*' -mtime +180 -exec rm



It doesn't work and the system sends a mail saying find: missing argument to '-exec'



What can I do to make it work as a cron task?







share|improve this question














closed as unclear what you're asking by Michael Homer, Jeff Schaller, jimmij, Rui F Ribeiro, meuh Jan 14 at 19:41


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.














  • use find like this /usr/bin/find in the cron
    – George Udosen
    Jan 14 at 1:01










  • Are you sure the first version is working? You appear to have a shell escape ` but no actual character (AFAIK it should be ; - or optionally + if your version of find supports it)
    – steeldriver
    Jan 14 at 1:02











  • Yes, the first command works as it's written. I will try adding /usr/bin/find now.
    – Dan P.
    Jan 14 at 1:03






  • 3




    Two additional notes: what do you think -name '*' accomplishes? Also, some versions of find support -delete.
    – dhag
    Jan 14 at 1:24






  • 2




    No, -name '*' is not needed
    – fpmurphy1
    Jan 14 at 1:47













up vote
1
down vote

favorite









up vote
1
down vote

favorite











I can successfully run this command in the terminal:



find /home/www/files/1 -type f -name '*' -mtime +180 -exec rm



However when I add it as a cron job like so:



*/5 * * * * find /home/www/files/1 -type f -name '*' -mtime +180 -exec rm



It doesn't work and the system sends a mail saying find: missing argument to '-exec'



What can I do to make it work as a cron task?







share|improve this question














I can successfully run this command in the terminal:



find /home/www/files/1 -type f -name '*' -mtime +180 -exec rm



However when I add it as a cron job like so:



*/5 * * * * find /home/www/files/1 -type f -name '*' -mtime +180 -exec rm



It doesn't work and the system sends a mail saying find: missing argument to '-exec'



What can I do to make it work as a cron task?









share|improve this question













share|improve this question




share|improve this question








edited Jan 14 at 1:38









Jeff Schaller

31.8k848109




31.8k848109










asked Jan 14 at 0:58









Dan P.

496




496




closed as unclear what you're asking by Michael Homer, Jeff Schaller, jimmij, Rui F Ribeiro, meuh Jan 14 at 19:41


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.






closed as unclear what you're asking by Michael Homer, Jeff Schaller, jimmij, Rui F Ribeiro, meuh Jan 14 at 19:41


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.













  • use find like this /usr/bin/find in the cron
    – George Udosen
    Jan 14 at 1:01










  • Are you sure the first version is working? You appear to have a shell escape ` but no actual character (AFAIK it should be ; - or optionally + if your version of find supports it)
    – steeldriver
    Jan 14 at 1:02











  • Yes, the first command works as it's written. I will try adding /usr/bin/find now.
    – Dan P.
    Jan 14 at 1:03






  • 3




    Two additional notes: what do you think -name '*' accomplishes? Also, some versions of find support -delete.
    – dhag
    Jan 14 at 1:24






  • 2




    No, -name '*' is not needed
    – fpmurphy1
    Jan 14 at 1:47

















  • use find like this /usr/bin/find in the cron
    – George Udosen
    Jan 14 at 1:01










  • Are you sure the first version is working? You appear to have a shell escape ` but no actual character (AFAIK it should be ; - or optionally + if your version of find supports it)
    – steeldriver
    Jan 14 at 1:02











  • Yes, the first command works as it's written. I will try adding /usr/bin/find now.
    – Dan P.
    Jan 14 at 1:03






  • 3




    Two additional notes: what do you think -name '*' accomplishes? Also, some versions of find support -delete.
    – dhag
    Jan 14 at 1:24






  • 2




    No, -name '*' is not needed
    – fpmurphy1
    Jan 14 at 1:47
















use find like this /usr/bin/find in the cron
– George Udosen
Jan 14 at 1:01




use find like this /usr/bin/find in the cron
– George Udosen
Jan 14 at 1:01












Are you sure the first version is working? You appear to have a shell escape ` but no actual character (AFAIK it should be ; - or optionally + if your version of find supports it)
– steeldriver
Jan 14 at 1:02





Are you sure the first version is working? You appear to have a shell escape ` but no actual character (AFAIK it should be ; - or optionally + if your version of find supports it)
– steeldriver
Jan 14 at 1:02













Yes, the first command works as it's written. I will try adding /usr/bin/find now.
– Dan P.
Jan 14 at 1:03




Yes, the first command works as it's written. I will try adding /usr/bin/find now.
– Dan P.
Jan 14 at 1:03




3




3




Two additional notes: what do you think -name '*' accomplishes? Also, some versions of find support -delete.
– dhag
Jan 14 at 1:24




Two additional notes: what do you think -name '*' accomplishes? Also, some versions of find support -delete.
– dhag
Jan 14 at 1:24




2




2




No, -name '*' is not needed
– fpmurphy1
Jan 14 at 1:47





No, -name '*' is not needed
– fpmurphy1
Jan 14 at 1:47











1 Answer
1






active

oldest

votes

















up vote
2
down vote













You are missing the semi colon at the end of the -exec argument.






share|improve this answer



























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    2
    down vote













    You are missing the semi colon at the end of the -exec argument.






    share|improve this answer
























      up vote
      2
      down vote













      You are missing the semi colon at the end of the -exec argument.






      share|improve this answer






















        up vote
        2
        down vote










        up vote
        2
        down vote









        You are missing the semi colon at the end of the -exec argument.






        share|improve this answer












        You are missing the semi colon at the end of the -exec argument.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jan 14 at 1:41









        jmw

        213




        213












            Popular posts from this blog

            How to check contact read email or not when send email to Individual?

            Bahrain

            Postfix configuration issue with fips on centos 7; mailgun relay