Anonymous Anonymous - 1 year ago 63
C Question

How to set up a cron job to run an executable every hour?

I need to set up a cron job that runs an executable compiled using gcc once every hour.

I logged in as root and typed

crontab -e

Then I entered the following and saved the file.

0 * * * * /path_to_executable

However, the cron job does not work.

I see that when I type
I get a segmentation fault.
I can only execute the executable from the folder it is located in.
Is there a way I can solve this problem?

Answer Source
0 * * * * cd folder_containing_exe && ./exe_name

should work unless there is something else that needs to be setup for the program to run.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download