forked from recolic/micro-teaching-assistant-fucker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
daemon.sh
executable file
·37 lines (30 loc) · 808 Bytes
/
daemon.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash
[[ $1 == '' ]] && echo "usage: $0 sign/ans/all" && exit 1
[[ $_openid == "" ]] && echo 'Give openid or url please:' && read _openid
_openid=$(echo "$_openid" | sed 's/^.*openid=//g' | sed 's/&.*$//g')
echo "Set openid to $_openid"
function _segfault_detected () {
echo "WARNING: segfault captured!"
while true; do
$_audio_player error.mp3
[[ $? == 127 ]] && exit 127
sleep 2
done
}
if [[ $1 == all ]]; then
_openid="$_openid" $0 sign &
_openid="$_openid" $0 ans
exit 0
fi
cd impl
if [[ $1 == sign ]]; then
_openid="$_openid" ./daemon-signin.fish
[[ $? == 127 ]] && exit 127
_segfault_detected
fi
if [[ $1 == ans ]]; then
_openid="$_openid" ./daemon-answer.fish
[[ $? == 127 ]] && exit 127
_segfault_detected
fi
cd ..