Thursday, October 23, 2008

at Vs Cron ?

can anyone explain me the tradeoff b/w at command and cron command ?
is there any special situation where at command should only be used?
which command is more preferred at or cron ?



kpkeerthi

'at' lets you run a task (a command or a program) at a scheduled time once.

'cron' lets you schedule a task to run periodically. You define the 'period' using cron expressions.

More info: https://help.ubuntu.com/community/CronHowto

billymayday

Typically at is a once off whereas cron is recurring. Neither is preferred, they are for different purposes (see previous sentence).

I use at quite a bit to start a process from an ssh session when I want to disconnect and leae it running. It's also good for doing downloads later in the night, etc.

Cron does routine tasks like backups that happen every day/week/whatever. I have one that marks my spam folder read every hour.

colucix

One advantage of the at command is that it preserves the user's shell environment, whereas cron runs in its own limited environment. But as billymayday already pointed out, at is for delayed tasks, cron is for recurrence.

No comments:

Post a Comment