在 MacO 上将 at 和 batch 实用程序与 zsh 一起使用
Using the at and batch utilities with zsh on MacOs
我正在尝试使用 at
实用程序安排一项一次性工作。我在尝试:
at 13:00
,然后按回车键,然后
<name_of_shell_script>
,
然后 ctrl+d
.
我脚本的第一行是:#!/bin/zsh
但从未执行过。它在 运行 手动执行,但在使用 at 实用程序安排时不执行。
由于您使用的是 zsh,请尝试改用 sched
:
- 添加到您的
.zshrc
文件:
zmodload zsh/sched
- 重启你的 shell.
- 使用方法如下:
sched 13:00 <absolute path to shell script>
有关详细信息,请参阅 http://zsh.sourceforge.net/Doc/Release/Zsh-Modules.html#The-zsh_002fsched-Module。
此外,请确保您的脚本文件实际设置为可执行文件:
chmod a+x <absolute path to shell script>
我正在尝试使用 at
实用程序安排一项一次性工作。我在尝试:
at 13:00
,然后按回车键,然后
<name_of_shell_script>
,
然后 ctrl+d
.
我脚本的第一行是:#!/bin/zsh
但从未执行过。它在 运行 手动执行,但在使用 at 实用程序安排时不执行。
由于您使用的是 zsh,请尝试改用 sched
:
- 添加到您的
.zshrc
文件:zmodload zsh/sched
- 重启你的 shell.
- 使用方法如下:
sched 13:00 <absolute path to shell script>
有关详细信息,请参阅 http://zsh.sourceforge.net/Doc/Release/Zsh-Modules.html#The-zsh_002fsched-Module。
此外,请确保您的脚本文件实际设置为可执行文件:
chmod a+x <absolute path to shell script>