Linux:在前台运行cron作业 [英] Linux: Run cron job in foreground
本文介绍了Linux:在前台运行cron作业的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在Linux中,有没有办法在前台(或交互模式)运行cron作业? (我有一个程序,定期运行接受用户输入和做一些处理,所以我想计划为一个cron作业,可以在前台运行)。
In Linux, is there a way to run a cron job in the foreground (or interactive mode)? (I have a program that runs periodically to accept user input and do some processing. So I want to schedule it as a cron job that can run in the foreground).
推荐答案
请在您的用户 crontab
上尝试:
@hourly DISPLAY=:0 xterm -e /path/to/my/script.sh
它会在脚本执行时打开(每小时)一个 xterm
,并在脚本退出后退出。当然,您应该修改 @hourly
部分以满足您的需要。
It will open (hourly) an xterm
with your script executing, and exit after your script exits. Of course, you should modify the @hourly
part to suit your needs.
这篇关于Linux:在前台运行cron作业的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文