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?
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.
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.
0 * * * * cd folder_containing_exe && ./exe_name
should work unless there is something else that needs to be setup for the program to run.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With