使用Python,我可以輕鬆地提高當前進程的nice值: >>> import os
>>> import psutil
>>> # Use os to increase by 3
>>> os.nice(3)
3
>>> # Use psutil to set to 10
>>> psutil.Process(os.getpid()).nice(10)
>>> psutil.P
我想出來算出這個查詢,並不能弄清楚它是如何涉及: Where iInteractionOpenReasonID & 16 = 0
爲iInteractionOpenReasonID可能的值應該是: 0 Unknown
1 Normal Start
2 Normal End
4 Transfer Start
8 Transfer End
16 Conference
32 Inter
我想確保腳本只能運行在某個好的級別下。我搜索周圍,我沒有發現這樣做的一個很好的方式,所以我想出了這個: #!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
# use ps to get the niceness of the current process
# only look at the last line of output
#