Created
April 15, 2019 18:42
-
-
Save gourytch/766f0227e86f8f48e7f3fc72f9e98584 to your computer and use it in GitHub Desktop.
launch separate Telegram instance from /snap
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/sh | |
set -e | |
set -x | |
ulimit -v 4000000 | |
ulimit -c 2000000 | |
export BAMF_DESKTOP_FILE_HINT=/var/lib/snapd/desktop/applications/telegram-desktop_telegramdesktop.desktop | |
telegram="/snap/bin/telegram-desktop" | |
tgid="$(basename $0 .sh)" | |
if [ -n "$tgid" ]; then | |
workdir="$HOME/snap/telegram-desktop/current/.local/share/$tgid" | |
if ( ps -ax | grep -v grep | grep 'Telegram' | grep -qF "$workdir" ) ; then | |
echo "telegram instance $tgid seems already started" | |
exit | |
fi | |
test -d "$workdir" || mkdir -p "$workdir" | |
wd="-workdir $workdir" | |
else | |
if ( ps -ax | grep -v grep | grep -qF Telegram ) ; then | |
echo "telegram instance seems already started" | |
exit | |
fi | |
fi | |
echo "start telegram instance $tgid ..." | |
if [ -z "$*" ]; then | |
$telegram -noupdate -many $wd &>/dev/null & | |
else | |
$telegram -noupdate -many $wd $* | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment