I am facing an issue in running a command line utility from the CRON.
This utility displays IPC statistics on UNIX message queues: The "queue name" and the "count" of messages in the queue.
When running this utility from prompt, it will provide an output on the screen, like the below:
>ABC
====================================================
Line Queue Name In-queue %Used Queue-Size Status
=====================================================
1 q1 0 0% 1 RdBlk
2 q2 0 0% 1 RdBlk
BUT, when I schedule this command in the CRON, like below, it gives out nothing:
I get a syntax error at the ) . What shell are you using that allows you to run that command?
What OS are you using?
If the seemingly extraneous closing parenthesis isn't your problem, jobs started by cron have a much more restricted environment than what you get when you login to the system. Does /path/to/utility/ABC depend on any environment variables? Is it a shell script? If it is a shell script, do the files it needs to run exist in the directory where cron runs your script? If it is a shell script does cron start it using a shell compatible with the shell you expect to run your script?
As you mentioned, the CRON provide a more restrictive env., than actually logging in, can you please guide on how to make sure that proper env. is available to CRON so proper execution of that utility takes place?
Thanks for providing the excellent cue about the env settings difference with respect cron and when one logs in.
Added the paths etc. and the utility works fine as required!