Skip to content

Commit 6af6cd8

Browse files
committed
新增MAC环境下定时任务at的说明
1 parent 4cd05fc commit 6af6cd8

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

Mac.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,3 +103,22 @@ EF0C7F72D8917DB538A0245E46BFD6B1
103103
✗ sudo mv Install\ macOS\ Sierra.app ~/tools/
104104
```
105105
然后可以制作U盘启动盘
106+
107+
108+
## at
109+
110+
Mac 环境下,必须先启动 atrun (默认是关闭的)
111+
```bash
112+
man atrun # 查看文档
113+
sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.atrun.plist # 开启服务
114+
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.atrun.plist # 关闭服务
115+
```
116+
117+
定时任务
118+
```bash
119+
echo `date`
120+
at now + 1 minute <<< "/bin/echo `date` > /tmp/time.log"
121+
at now + 10 minutes <<< "/bin/echo `date` > /tmp/time.log" # 创建任务
122+
at -l # 列出任务
123+
at -c 1 # 显示任务内容
124+
```

0 commit comments

Comments
 (0)