LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Command for executing C program in crontab (https://www.linuxquestions.org/questions/linux-newbie-8/command-for-executing-c-program-in-crontab-569333/)

bhandu 07-14-2007 12:47 PM

Command for executing C program in crontab
 
I have a "C" program "test.c" stored in /etc directory path. To execute this program thru crontab I have written the following entry in cron file as follows


52 1 * * *

But what is the commmand to be entered in the command to execute this script?

macemoneta 07-14-2007 12:54 PM

A C program is not a script; it is source code that must be compiled before use. You can compile the program and then invoke it from cron with its (fully qualified) name. For example, if you compile "test.c" to the executable "test", and place it in /usr/local/bin, your cron entry would be:

52 1 * * * /usr/local/bin/test

You should not place executables in the /etc directory; that is not where they belong. The /etc directory is for configuration parameters. Executables should be placed in a bin directory. Locally created executables that are available system-wide should be in /usr/local/bin/.


All times are GMT -5. The time now is 10:08 PM.