-
Notifications
You must be signed in to change notification settings - Fork 0
/
tel-restart
executable file
·44 lines (38 loc) · 1.01 KB
/
tel-restart
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
38
39
40
41
42
43
44
#!/usr/bin/env bash
source tel-helpers
show_help(){
printf "%s\n"\
"Restart the TEL app"\
"tel-restart [OPTIONS]"\
"__________________________"\
"OPTIONS"\
" -h | --help display this help message"\
" -p | --prompt show a 'Press Enter' prompt if app is not active"
exit 0
}
remove_status(){
kill "$(pgrep -f 'status_manager.py')" > /dev/null 2>&1
pkill -f 'termux-api' >/dev/null 2>&1
tel-delete-status -1
}
restart_tel(){
remove_status
am broadcast --user 0 -a com.termux.app.restart com.termux > /dev/null 2>&1
}
restart_tel_with_prompt(){
remove_status
am broadcast --user 0 -a com.termux.app.restart com.termux > /dev/null 2>&1
log "Press [Return] to restart TEL"
read
am broadcast --user 0 -a com.termux.app.restart com.termux > /dev/null 2>&1
}
main(){
if [ "$1" == "-h" ] || [ "$1" == "--help" ] ; then
show_help
elif [ "$1" == "-p" ] || [ "$1" == "--prompt" ] ; then
restart_tel_with_prompt
else
restart_tel
fi
}
main "$@"