File size alert

Hello,

I want to check the size of text files in a directory continuously via cronjob.
I would like to receive an e-mail alert if the file is greater than 0 kb.

Thank you for your help.

Try with..

wc -c < file

From the man page of man test (POSIX):

So it's a simple if with test, and if the result is true send a mail using mailx.

[ -s infile ] || mailx -s "Alert" yourmailbox