[nmglug] cron e-mail /dev/null
a
a at kaluta.us
Mon Jan 25 07:09:48 PST 2010
Ed:
Thank you for the well thought out suggestion,I am pretty new to this
stuff, please forgive any inaccuracies in the following:
I have been given a limited server account on which to doodle,I do not
have access to any bin directories.however,I will use your suggestion to
familiarize myself with the various components of your your informative
directive. Best,Anthony
On Mon, 2010-01-25 at 06:40 -0700, Ed Santiago wrote:
> On Mon, 25 Jan 2010 05:52:01 -0700, a wrote:
> >When there is "*.jpg" content the cronjob successfully reads:
> >"/home/kaluta/kaluta.us/jerry-camera/*.jpg".
> >
> >When there is not "*.jpg" content (i.e. camera off). I am e-mailed the
> >following message hourly by cron:
> >"/usr/bin/find: /home/kaluta/kaluta.us/jerry-camera/*.jpg: No such file"
> >or directory.
> >
> >Can anyone suggest a method of avoiding the "superfluous" hourly e-mail.
> >tnx, Anthony
>
> * Snip at cut-here.
> * Save into a file named "camera-clean" (or whatever you like),
> in a bin directory of your choosing.
> * Make it executable [ chmod 755 /my/bin/camera-clean ]
> * Put it into source control (git, hg, even RCS).
> * Fix the FIXMEs (you'll thank yourself later).
> * Change your cron rule to:
>
> - ...* * [complex find command]
> + ...* * /my/bin/camera-clean
>
> Writing a short script may seem like overkill. It's not.
> Complex cron entries are unmaintainable.
>
> Hope this helps,
> Ed
>
> ---------------cut--here--------------------------------------------
> #!/bin/sh
> #
> # camera-clean - clean up blah blah blah FIXME
> #
> # $Id$
> #
>
> # Directory containing images. jpg files are deposited here by FIXME.
> cd /home/kaluta/kaluta.us/jerry-camera || exit 1
>
> # Look for jpg files older than 1 day, and silently delete them.
> # Only look in current directory (-maxdepth), not in subdirectories.
> find . -maxdepth 1 -name '*.jpg' -mtime +1 -print0 | \
> xargs -0 --no-run-if-empty rm -f
> _______________________________________________
> nmglug mailing list
> nmglug at nmglug.org
> https://nmglug.org/mailman/listinfo/nmglug
More information about the nmglug
mailing list