OSDN Git Service

new pidfile
[instantos/instantOS.git] / programs / autodiscord
1 #!/bin/bash
2
3 ############################################################
4 ## Auto restart discord when it silently decides to crash ##
5 ############################################################
6
7 # toggle like behaviour
8 if [ -e /tmp/instantos/discord ]; then
9     echo "discord restart disabled"
10     rm /tmp/instantos/discord
11     exit
12 else
13     echo "discord restart enabled"
14     mkdir /tmp/instantos
15     touch /tmp/instantos/discord
16 fi
17
18 while :; do
19     if ! [ -e /tmp/instantos/discord ]; then
20         exit
21     fi
22
23     if command -v discord; then
24         if ! pgrep discord; then
25             discord
26         fi
27     elif command -v Discord; then
28         if ! pgrep Discord; then
29             Discord
30         fi
31     fi
32
33     sleep 10
34 done