• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Create a cron job which sends an email alert when a certain condition is satisfied

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a backend MySQL database which keeps track of the number of invalid accesses to a file on a web server(I am new to the use of cron jobs though)I want an email to be sent to the file owner when the number of accesses exceed a certain number.Could anyone please suggest how this could be done using JSP?
Thanks in advance.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
JSP does not seem like a suitable technology to use for this purpose. Why do you want to use JSP for this?
 
Chaitra Kear
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, I heard a sever side scripting language like PHP could get the job done.
Since my web application uses JSP at the front end,wanted to know if it could do the same.
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
First of all, your post doesn't make it sound like the email will be sent from the web application, but as part of the cron job. So it's not even part of the web app.

Also, JSP is well suited to serving as a template for responses, but not so much for general-purpose templating.

For that, most people would use a more general-purpose templating tool such as FreeMarker.
 
Chaitra Kear
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok, suppose I make use of MySQL triggers instead of the cron job,then will it be possible?The app has been coded up in netbeans,so I don't understand how an external tool can be used here.
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Chaitra Kear wrote:Ok, suppose I make use of MySQL triggers instead of the cron job,then will it be possible?


Triggers has nothing at all to do with JSP. Again, you are barking up the wrong tree. I don't think JSP is the right tool for the job.

The app has been coded up in netbeans,so I don't understand how an external tool can be used here.


So what? Netbeans is an editor. What does it have to do with the ability to use "external tools"?
 
Chaitra Kear
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Oh got it, FreeMarker can be used as a NetBeans plugin.I am so naive, and i admit it.
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Freemarker is a library (jar). NetBeans (and all other IDEs) let you add jars to your classpath. You could also use a Freemarker plugin to make you editing easier. But that's independent of getting the jar itself.

I question whether you even need Freemarker. Unless your email is complicated, you might just concatenate strings to compose the email. It's a minor part of the problem - just for the formatting part.
 
Chaitra Kear
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As you said, I don't think I need FreeMarker at all, because my email isn't going to be complicated(just a fixed message to reset their password).However MySQL by itself cannot send the email I believe.There were suggestions on the net to make the trigger run an external script(written in PHP ) which does this.And there's this JavaMail API,which also comes to my mind.I am confused as to what to use now.Thank you.
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Chaitra Kear wrote:As you said, I don't think I need FreeMarker at all, because my email isn't going to be complicated


Then why did you feel you needed JSP? I assumed it was because you needed templating for the email body.

However MySQL by itself cannot send the email I believe.There were suggestions on the net to make the trigger run an external script(written in PHP ) which does this


If this is a cron job, why not just do it from the shell? If you don't need templating, you could likely just use the mail shell command. (Or is this running on Windows? I assume not.)

And there's this JavaMail API


That's what you would use if you were to do this from Java.

 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic