Cer*_*rin 3 linux bash shell cron crontab
有没有办法从命令行创建临时的一次性cron作业?我想有一个像蛋计时器一样的功能来打开终端并执行:
notify "time is up" 30
Run Code Online (Sandbox Code Playgroud)
这将在30分钟后运行:
zenity --info --text="time is up"
Run Code Online (Sandbox Code Playgroud)
对我来说似乎很容易创造,但我很难相信没有人创造出类似的东西.在Ubuntu的存储库中搜索时序包并没有显示任何内容.以前做过吗?
使用该at
命令.
$ at now + 30 minutes
at> zenity --info --text="time is up"
at> ^D (press CTRL-D)
Run Code Online (Sandbox Code Playgroud)
时间格式非常灵活.这是一堆例子.
$ at 11:45
$ at 0800 Friday
$ at 4pm + 3 days
$ at 9am tomorrow
Run Code Online (Sandbox Code Playgroud)
如果你知道你的$DISPLAY
意愿是一样的,你可以这样做:
echo "DISPLAY=$DISPLAY zenity --info --text=\"time is up\"" | at now + 30 minutes
Run Code Online (Sandbox Code Playgroud)
以这种方式提供环境变量将使其zenity
在运行时可用。
归档时间: |
|
查看次数: |
4244 次 |
最近记录: |