Find the answer to your Linux question:
Results 1 to 3 of 3
Hi I am very new to linux. I want to run a cronjob every 15 minutes that checks a directory for files. If the directory contains more than ten files ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Oct 2010
    Posts
    2

    crontab help


    Hi I am very new to linux. I want to run a cronjob every 15 minutes that checks a directory for files. If the directory contains more than ten files I want it to send an email to me.

    All I have is this...

    */15 * * * * ls -l | wc -l | [filename] | mail -s "This is just a test" [email address]

    I would rather not write a bash script. Is there an easier way to do this? I was looking into some commands like find and grep

    Could somone show me an example?

    Thanks,
    LN

  2. #2
    ved
    ved is offline
    Linux User ved's Avatar
    Join Date
    Jan 2008
    Location
    New Delhi
    Posts
    309

    Smile

    That is not as you want but it may be help
    HowTo: Add Jobs To cron Under Linux or UNIX?
    Last edited by ved; 10-14-2010 at 12:25 PM.
    Take risks: if you win, you will be happy; if you lose, you will be wise.
    New Users : Read This First

  3. #3
    Linux Guru coopstah13's Avatar
    Join Date
    Nov 2007
    Location
    NH, USA
    Posts
    3,149
    what do you mean you don't want to write a bash script? what do you think cronjob does and how it runs? it is basically a shell script, but it can run anything from there

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •