Skip to content

Commit

Permalink
docs: update issue 345
Browse files Browse the repository at this point in the history
  • Loading branch information
toFrankie committed Aug 3, 2024
1 parent dcb107a commit a9476c4
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions archives/2024/345.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: iCloud 云盘同步卡住的解决方法
number: '#345'
link: 'https://github.com/toFrankie/blog/issues/345'
created_at: '2024-08-03 16:56:44'
updated_at: '2024-08-03 16:57:07'
updated_at: '2024-08-03 17:24:49'
labels:
- '2024'
- Mac
Expand Down Expand Up @@ -63,14 +63,14 @@ Mac OS X 22/04/14
## 调整进程优先级
1. 执行 `ps aux | grep bird`,你会看到类似的输出,其中 `4137` 为进程 ID(PID)。
1. 执行 `ps aux | grep bird`,会看到类似的输出。其中 `4137` 为进程 ID(PID)。
```shell
$ ps aux | grep bird
frankie 4137 0.0 0.1 33705140 10160 ?? S 4:01下午 0:06.68 /System/Library/PrivateFrameworks/CloudDocsDaemon.framework/Versions/A/Support/bird
```
2. 执行 `ps -fl -C <PID>` 查看某进程优先级。
2. 执行 `ps -fl -C <PID>` 查看某进程优先级。其中 `NI` 是指 nice 值,表示一个进程的优先级。
```shell
$ ps -fl -C 4137
Expand All @@ -85,3 +85,12 @@ $ sudo renice -n -10 -p 4137
```
> 负数优先级更高,据说 `-20` 最高,但不建议,这里使用 `-10`(参考[这里](https://stackoverflow.com/a/72534456/14569218))。
根据以上自定义两个 alias,可添加到 `.bash_profile` 或 `.zshrc` 里。
```bash
alias renice_bird_process='BIRDPID=$(ps aux | grep -i bird | awk '\''{print $2}'\'' | head -1); sudo renice -n -10 -p $BIRDPID'
alias show_bird_process_priority='BIRDPID=$(ps aux | grep -i bird | grep -v grep | awk '\''{print $2}'\'' | head -1); ps -o pid,ni -p $BIRDPID'
```

0 comments on commit a9476c4

Please sign in to comment.