-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathautostart.sh
executable file
·58 lines (44 loc) · 1.19 KB
/
autostart.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/bash
CURDIR=$(dirname $0)
cd "$CURDIR"
MAINPID=$$
if [ -f output.file ]
then
echo -ne "" > output.file
fi
echo -ne "\n\e[94m" >> output.file
date >> output.file
if [ -z $1 ]
then
echo -e "-----------------------------" >> output.file
echo -e " STARTED BY LXSESSION. " >> output.file
fi
echo -e "-----------------------------" >> output.file
echo -e " AUTOSTART. " >> output.file
echo -e "-----------------------------" >> output.file
echo -e "" >> output.file
echo -e "" >> output.file
function terminate {
echo -e "\e[33m\n\n" | tee -a output.file
echo -e "-----------------------------" | tee -a output.file
echo -e " AUTOSTART TERMINATED. " | tee -a output.file
echo -e "-----------------------------" | tee -a output.file
echo -e "\n\n" | tee -a output.file
disown $PROC1 2>/dev/null
kill -SIGTERM $PROC1
disown $PROC2 2>/dev/null
kill -SIGTERM $PROC2
# disown $PROC3
kill -SIGTERM $PROC3
trap SIGINT;
trap SIGTERM;
kill $$ 2>/dev/null
# kill -2 $MAINPID
}
trap terminate SIGINT
trap terminate SIGTERM
./bootstrap.sh >> output.file & PROC1=$!
tail -f output.file & PROC2=$!
##creates input pipe for kill command
./input.sh $MAINPID & PROC3=$!
wait