-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathttytter_startup.sh
More file actions
executable file
·54 lines (50 loc) · 923 Bytes
/
ttytter_startup.sh
File metadata and controls
executable file
·54 lines (50 loc) · 923 Bytes
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
#!/bin/sh
#
# Check if ttytter is already running inside tmux and if it's not launch
# it
run_tmux() {
tmux new-session -d -s TTYtter -n TTYtter 'DISPLAY=:0.0 ttytter -rc=-donearm'
if [ $? -eq 1 ]
then
sleep 20 # wait a bit, internet connection may not be ready
run_tmux
else
tmux select-window -t TTYtter:0 2> /dev/null
exit 0
fi
}
run_screen() {
screen -dm -c ~/.screenrc-ttytter &
if [ $? -eq 1 ]
then
sleep 20 # wait a bit, internet connection may not be ready
run_screen
else
exit 0
fi
}
# Do we have screen or tmux?
SCREEN=$(hash screen &>/dev/null)
if [ $? -eq 1 ]
then
# no screen installed, maybe tmux
TMUX=$(hash tmux &>/dev/null)
if [ $? -eq 0 ]
then
RUNNING=$(tmux has-session -t TTYtter)
if [ $? -eq 1 ]
then
run_tmux
fi
else
echo "No screen or tmux found, exiting..."
exit 1
fi
else
RUNNING=$(screen -q -ls)
if [ $? -lt 10 ]
then
run_screen
fi
fi
exit 0