Created
June 10, 2017 06:44
-
-
Save cirfi/4e2302c59c983d96ca83820cb156458c to your computer and use it in GitHub Desktop.
Tdesktop Auto Restarter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
for ((;;)) | |
do | |
mem=$(ps -C telegram-desktop -o rss= | tail -1) | |
if ((!mem)); then | |
echo 'Starting Telegram Desktop...' | |
telegram-desktop & | |
sleep 300 | |
continue | |
fi | |
echo 'Current Memory Usage: '$mem' KB' | |
if (($mem > '500000')); then | |
echo 'Restarting Telegram Desktop...' | |
killall telegram-desktop | |
telegram-desktop & | |
fi | |
sleep 300 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment