If I have a script called teiid.sh set to run daily by a cron job. The scripts purpose is to initialize the startup of teiid.

How would I make a call to test to see the if teiid.sh is working properly with cron, and not just performing endless actions or no action at all?


@daily * * * * /etc/init.d/teiid.sh jeff@****.edu

Would chkconfig --add /etc/init.d/teiid.sh help with anything at all?

  • If your script is called script.sh why do you have /etc/init.d/teiid.sh in your crontab? – Emil Mar 27 '12 at 20:44
  • sorry I updated it, I was using it for script.sh for explanation purposes. The actual script is teiid.sh – Jeff Mar 27 '12 at 20:47
  • What are you actually trying to do: have teiid.sh run after you boot the computer (seems probable) or make it run every day at midnight (this is what your cronjob would actually do)? – rozcietrzewiacz Mar 27 '12 at 22:54
  • To clarify: I asked the above question mainly because /etc/init.d is not the place to put your daily cron jobs, but where system startup scripts reside. System-wide scripts that should be run daily by cron live under /etc/cron.daily. – rozcietrzewiacz Mar 27 '12 at 23:00

you can do 2 things..

  1. check /var/log/cron to check if it's being executed
  2. add > /tmp/log 2>&1 to the end of the cron entry. then cat /tmp/log to check if the output is correct.

Making a call to the script to test if it is working properly?
When you wrote it did you test it? Running it with cron would be no different.

Other possibilities - output of your script to a file - trace what your script is doing by adding -x to the "shebang" #!/bin/bash -x or put set x on the next line after

This will provide the trace output. Either way you need to be able to see this information. And if you are not there or can not see it you will have to output it to a file.

As far as the chkconfig command. Depending on the distro this will add it to the appropriate runlevels with S start and K kill scripts. Usually if it has the LSB header information. Or you can manually create the symlinks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.