[Exchange and share] 不关机直接休眠待机又怕dde-dock内存溢出的解决方法
Tofloor
poster avatar
TLT
deepin
2024-03-13 09:39
Author
#!/bin/bash
#最大值
max_memory=$1
if [[ -z $max_memory ]]; then
	max_memory=256
fi

#获取dde-dock的内存占用情况
PID_STR=$(ps -ef | grep "dde-dock$" | awk '{print$2}')
if [[ -z $PID_STR ]]; then
	nohup dde-dock > /dev/null 2>&1 &
else
	now_memory=`ps -p $PID_STR -o rss= | awk '{printf "%.2f\n", $1/1024}'`
	echo $now_memory,$max_memory 
	if [[ $(echo "$now_memory > $max_memory" | bc -l) -eq 1 ]];then
		killall dde-dock && nohup dde-dock > /dev/null 2>&1 &
	fi
fi

Reply Favorite View the author
All Replies
兆兆嘟嘟嘟
deepin
2024-03-13 13:16
#1

感谢分享。

Reply View the author
Jamesjiang
deepin
2024-03-13 14:01
#2

是每次使用,还是几天运行一次。具体怎么使用啊

Reply View the author
忘记、过去
deepin
2024-03-13 14:57
#3

V23 里面好像可以 systemctl --user restart dde-dock 吧?似乎注册了一个服务

Reply View the author
TLT
deepin
2024-03-13 15:51
#4
Jamesjiang

是每次使用,还是几天运行一次。具体怎么使用啊

觉得内存溢出了就运行下

Reply View the author