-
Notifications
You must be signed in to change notification settings - Fork 2
/
check_docker.sh
executable file
·48 lines (39 loc) · 1.1 KB
/
check_docker.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
#!/usr/bin/env bash
# Delete garbage folder
rm -rf /var/lib/docker/containers_
# Check that docker is up
if ( ! systemctl -q is-active docker)
then
logger -s "Restart the docker service"
systemctl stop docker && systemctl start docker
fi
if ( ! systemctl -q is-active docker)
then
logger -s "Remove /var/lib/docker/runtimes and restart the docker service"
systemctl stop docker
rm -rf /var/lib/docker/runtimes
systemctl start docker
fi
if ( ! systemctl -q is-active docker)
then
logger -s "Remove /var/lib/docker/runtimes, /var/lib/docker/containers and restart the docker service"
systemctl stop docker
rm -rf /var/lib/docker/runtimes
rm -rf /var/lib/docker/containers
rm -rf /var/lib/docker/containerd
mv /var/lib/docker/containers /var/lib/docker/containers_
systemctl start docker
fi
if ( ! systemctl -q is-active docker)
then
logger -s "Could not launch docker"
return 1
fi
# Check that the (essential) services are up
cd /root/docker/mighty-thymio
services=$(docker-compose ps | wc -l)
if [ $services == "2" ]
then
logger -s "Recreate services"
source do_update.sh
fi