如何建立一个cron作业运行可执行每隔一小时? [英] How to set up a cron job to run an executable every hour?
本文介绍了如何建立一个cron作业运行可执行每隔一小时?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要设置运行使用gcc每小时一次编译可执行文件的cron作业。
我以root身份登录,并键入 crontab -e命令
然后我输入了以下和保存的文件。
0 * * * * / path_to_executable
不过,cron作业无法正常工作。
我看到,当我输入 / ... path_to_executable
我得到一个分段错误。
我只能从它位于该文件夹执行可执行文件。
有没有一种办法可以解决这个问题?
解决方案
0 * * * * CD folder_containing_exe&放大器;&安培; ./exe_name
应该工作,除非有别的东西,需要设置的程序来运行。
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?
解决方案
0 * * * * cd folder_containing_exe && ./exe_name
should work unless there is something else that needs to be setup for the program to run.
这篇关于如何建立一个cron作业运行可执行每隔一小时?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文