Command not working when run from cron [closed]
Clash 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?
linux find cron
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.
 |Â
show 5 more comments
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?
linux find cron
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 offind
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
 |Â
show 5 more comments
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?
linux find cron
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?
linux find cron
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 offind
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
 |Â
show 5 more comments
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 offind
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
 |Â
show 5 more comments
1 Answer
1
active
oldest
votes
up vote
2
down vote
You are missing the semi colon at the end of the -exec argument.
add a comment |Â
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.
add a comment |Â
up vote
2
down vote
You are missing the semi colon at the end of the -exec argument.
add a comment |Â
up vote
2
down vote
up vote
2
down vote
You are missing the semi colon at the end of the -exec argument.
You are missing the semi colon at the end of the -exec argument.
answered Jan 14 at 1:41
jmw
213
213
add a comment |Â
add a comment |Â
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 offind
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