aboutsummaryrefslogtreecommitdiff
path: root/src/dock_checker.sh
blob: 5b4f1f8df73f251d5757b862633f12eb467a4f2d (plain)
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
#!/usr/bin/env zsh

SCRIPT_DIR=$(dirname $(realpath $0))
cd $SCRIPT_DIR

rm .{un,}docked

while true; do
	if [ "$(./check_docked.sh)" = "docked" ]; then
		if [ -e .docked ]; then
			continue
		fi

		echo docking...

		rm -f .undocked
		sh/docked.sh

		touch .docked
	else
		if [ -e .undocked ]; then
			continue
		fi

		echo undocking...

		rm -f .docked
		sh/undocked.sh

		touch .undocked
	fi

	sleep 5
done