我想在休眠前运行 4 个命令,在更新后运行另外 2 个命令。是否也可以安排每个命令的时间/顺序,如果是,那么你能解释一下吗?
您可以在休眠或挂起之前和之后运行命令(注意有区别;休眠是磁盘,挂起是内存)通过在/etc/pm/sleep.d
以下位置创建脚本:
#!/bin/bash
case "$1" in
hibernate)
# put commands to run on hibernation here
;;
thaw)
# put commands to run when returning from hibernation here
;;
suspend)
# put commands to run on suspend here
;;
resume)
# put commands to run when returning from suspension
;;
esac
Run Code Online (Sandbox Code Playgroud)
脚本的文件名将决定脚本与 sleep.d 中的其他脚本相比的运行顺序。在您的脚本中,您的命令将按照您在脚本中放置的任何顺序运行。
归档时间: |
|
查看次数: |
5230 次 |
最近记录: |