[lug] CRON

Michael J. Hammel mjhammel at graphics-muse.org
Thu Sep 7 16:54:18 MDT 2000

Thus spoke John Starkey
> I need to have reminders show up on the screen and some I want emailed. If
> I write a script to simply echo "whatever I need to say to myself" how
> would I require a certain keystroke to confirm? ( an IF statement maybe?? 
> )

As far as I know you can't do this.  Cron runs without being attached to a
vt and it can't be told to grab a vt directly - the program you run will
have to do that.  For example, under X (which I know you don't want) I can
run xmessage or gmessage or whatever from cron *if* "xhost +localhost" was
run on that display already.  gmessage (or whatever) will prompt for user
input - and can do so because it has a connection to a display.  There
isn't a shell connected to a vt under cron, so your program called from
cron would have to open a vt and try to read/write from it.  In other
words, setting the following line as a cron job:

echo "this is a test message"

causes the output to go into /dev/null from cron.  There isn't any place for 
cron to display it.

Cron is specifically designed to run in the background without user
interaction, so I think adding user interaction from it is kind of a 
security violation.  Or at least I think it's generally frowned upon.

> Is it possible to do this on ttyS[1-6] and have input from one confirm for
> all the vt's??

Leave cron out of the picture and ask yourself if you can write a program
to do this just from your own shell prompt.  The answer is "probably not" -
at least not easily.  You might be able to do it in Perl.  I'd do it in C.
Cron just launches programs and doesn't give them access to a terminal
(display) device.  It really doesn't care too much what the program does.

> And in the daily entry in crontab what do the "*" represent. If I remember
> correctly they're 15 minute increments in the hourly line.

No, they're a wildcard meaning "any".  So if a * was in the hour field, it
would mean do it every hour.  If the * was in the day field, it would mean
do it every day.
Michael J. Hammel           |
The Graphics Muse           |   And your crybaby whiny-assed opinion would 
mjhammel at graphics-muse.org  |   be...?

More information about the LUG mailing list