UNIX (AIX) Cron Daemon

I've been told that the crontab file should not contain "commands." I believe they were referring to binaries versus batch; the implication being that batch files (i.e., scripts) are preferable. I am aware of no such restriction. I know that for some commands there are both transient (binary files) and shell built-ins (i.e., compiled into the shell). Regardless, I've never seen cron complain. What am I missing?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Obviously nothing.

Cron will execute any valid command for you, be it a script or a binary.
Since these "commands" are executed within a shell opened by cron you can also use builtins and shell keywords.

Please note that under AIX this shell is /bin/sh which is a hardlink to /bin/ksh, so you can only use those builtins recognized by ksh.

This restriction is not as hard as it might sound - many builtins have their binary equivalents, e.g. "echo" or "test".

As an example - I often use things like

* * * * * [ -d //dir/containing/scripts ] && /dir/containing/scripts/myscript

As you can see, even things like "[" (a builtin equivalent to "test") or "&&" work under cron.
I could also have used "if", "then" (shell keywords) and it would have worked.

So trust in cron and don't worry!


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Unix OS

From novice to tech pro — start learning today.