我想在休眠前运行 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
脚本的文件名将决定脚本与 sleep.d 中的其他脚本相比的运行顺序。在您的脚本中,您的命令将按照您在脚本中放置的任何顺序运行。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句