Restart SystemD service when Memory Usage in More than a threshold

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





My nemo-desktop instance keeps crashing due to a bug.

The file in ~/.config/autostart which autostart the service is:

[Desktop Entry]
Type=Application
Name=Nemo
Comment=Start Nemo desktop at log in
Exec=nemo-desktop
X-GNOME-AutoRestart=true
NoDisplay=true

So, I came up with a systemd service which will restart nemo-desktop when memory usage is 100MB.

sudo tee /etc/systemd/system/nemo-desktop-bug-workaround.service << END
[Unit]
Description=Nemo Desktop Bug Workaround
Wants=xdg-desktop-autostart.target
PartOf=graphical-session.target
BindsTo=graphical-session.target

[Service]
User=ismail
Group=ismail
Type=forking
StartLimitIntervalSec=3
ExecStart=/usr/bin/nemo-desktop
ExecStop=/usr/bin/nemo-desktop --quit
MemoryAccounting=true
# MemoryHigh=50000K
MemoryMax=100000K
Restart=always
KillMode=process

[Install]
WantedBy=graphical.target
END

systemctl daemon-reload
systemctl start nemo-desktop-bug-workaround.service
systemctl enable nemo-desktop-bug-workaround.service

Now the problem is, it crashes with the terminal emulators.

What am I doing wrong here?

[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux