Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 /...path_to_executable 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?

like image 541
Anonymous Avatar asked Aug 13 '10 06:08

Anonymous


People also ask

How do I run a cron job automatically?

Cron is a job scheduling utility present in Unix like systems. The crond daemon enables cron functionality and runs in background. The cron reads the crontab (cron tables) for running predefined scripts. By using a specific syntax, you can configure a cron job to schedule scripts or other commands to run automatically.

How do I set a cron schedule?

Cron jobs are scheduled at recurring intervals, specified using a format based on unix-cron. You can define a schedule so that your job runs multiple times a day, or runs on specific days and months.


1 Answers

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

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

like image 134
joast Avatar answered Sep 22 '22 06:09

joast