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
#!/bin/bash
PACKAGE='com.mixplorer'
if [ -n "$(pidof "$package")" ];
then
    am force-stop com.mixplorer && am start -n com.mixplorer/.activities.BrowseActivity; 
else 
    am start -n com.mixplorer/.activities.BrowseActivity;
fi

loopcleaner()
{
rm -rf /sdcard/log.txt
}

while [ -n "$(pidof "$package")" ];
do
    loopcleaner;
    sleep 2;

    if [ ! $(pidof $PACKAGE) ];
    then
    break
        touch /sdcard/successful.txt
    fi
    exit 0;
done