Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Suitable language for cron Jobs?

Tags:

I realize that it can depend on certain things (and obviously how efficient the code is written); but, in general, what is the most suitable and perhaps efficient language to use in writing cron jobs?

Does this simply come down to a question of what is the most efficient language period, or can the specificity of cron jobs determine one programming language over the other?

Also, does MySQL database operations affect the programming language of choice for cron jobs?

like image 545
Stephen Watkins Avatar asked Mar 02 '10 16:03

Stephen Watkins


2 Answers

Any language (in case of MySQL, any language with mySQL libraries) can be used as long as it has:

  1. Command line interface. Not sure which languages disualify - apparently even LOGO has CLI capable implementations now, though what use is LOGO in background program is somewhat beyond me :)

  2. Resulting code runs on whatever system your cron daemon is on (most usually, a Unix server, but I assume there are cron ports to Windows etc...)

Any other considerations have nothing to do with cron jobs.

Efficiency wise, it depends entirely on what the work done by the job is (but again, not really related to cron-ifying the job).

With some extreme performance-intensive exceptions, choose the best language you can develop in (based on your familiarity with it and the availability of needed libraries).

For performance sensitive code, the usual choice is C++ and/or Assembly for really optimized stuff - but to be honest the whole performance discussion is completely outside the scope of your question and I'm sure has plenty of perfectly-answered question on StackOverflow elsewhere.

like image 130
DVK Avatar answered Nov 15 '22 00:11

DVK


Since your code is running unattended at odd hours, you want a language with good error handling and reporting. Namely, it needs to print a traceback when it crashes.

like image 22
Joe Koberg Avatar answered Nov 15 '22 00:11

Joe Koberg