Hello all: I need to run a Java application every hour automatically. How to do it under Bourne/Korn shell? Please point some books or website that I can take a look if I have to write some shell scripts or through some other ways. Thanks in advance, Sarah
This is just an idea versus an answer for you. The way I would do it is write a C program that stays in an infinite while() loop. In the while loop you would create a new PThread in unix and execute the java application. Also, you would want to check for when that program has termintated and kill that PThread. Then, you can just set a timer, and do it every hour that way.
Thanks for all the reply. I take a look of the websites that talk about the cron job, but there is no one example telling me how to use "crontab -e" to edit the crontab file. I tried to use "crontab -e", but can not get any clue. Please help!
To use crontab's editing facility, you need to set an environment variable called EDITOR, where EDITOR it an editing program like /usr/bin/vi (on Solaris, anyway) or /usr/dt/bin/dtpad (if you're using CDE's notepad tool). This invocation will bring up the cron table for your account in the editing tool that you set, like so: $ EDITOR=/usr/bin/vi $ export EDITOR $ crontab -e <user> Of course, none of that tells you the file format that cron uses. For that, read the man page.
Make visible what, without you, might perhaps never have been seen. - Robert Bresson
This is what a crontab entry that mails a nagging messages to a user's webmail account looks like. One thing to beware of is that the SYSTEM crontab format is somewhat different that USER crontabs. The example is a user crontab. For safety's sake, it's a good idea to use absolute file references, even though the example doesn't. Cron is the recommended way to do this stuff because you don't have to do any "real" programming. I DON'T recommend writing a C program that does a poll-and-wait unless you really think that having a CPU usage of 100% means you're getting your money's worth :roll: There is a signal that can be used to allow a C program to sleep until an alloted time. But a custom C program is really not the "Unix" way. If I were to choose one distinguishing philosphy that's virtually unique to Unix it would be that one never writes a custom app if it's possible to do the same with a string of one or more system tools.
An IDE is no substitute for an Intelligent Developer.