September 20th, 2011, 09:11 AM
-
Need Help / Advice For Creating a Script
I have a RHEL 6.1 Linux server running an IBM server side application called Clearquest. My question is I'm being asked to have a script execute the following command every hour and then have it email me the results.
The command is as follows:
/opt/rational/base/cots/flexlm.11.8/i386_linux2/lmutil lmstat -c ratinoal_redirect.dat -a
Now my question is can I just plug that command in Cron and set it to run every hour or do I need to generate some kind of Bash script and then just tell Cron to run the script every hour? Either way I just need Linux to run that command above every hour and then finally, how would I format my Crontab to also email me the results of running that command?
October 3rd, 2011, 01:22 AM
-
You should be able to put the command in your crontab as is, I believe. I think cron has a limited environment, but since you're giving the full path to the script it should be OK. cron will email the output of the command by default (to your UNIX mailbox, usually in /var/spool/mail), though you'll need sendmail (or possibly another MTA) running.