forked from didiatworkz/screenly-ose-monitoring
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathentrypoint.sh
59 lines (54 loc) · 1.57 KB
/
entrypoint.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
59
#!/bin/bash
_VERSION=4.3
cat << "EOF"
_
____ | |
/ __ \__ _____ _ __| | __ ____
/ / _` \ \ /\ / / _ \| '__| |/ /|_ /
| | (_| |\ V V / (_) | | | < / /
\ \__,_| \_/\_/ \___/|_| |_|\_\/___|
\____/ www.atworkz.de
Screenly OSE Monitoring (SOMO)
EOF
echo
echo
echo
echo
export > /root/env.sh
#Fix cron execution
touch /etc/crontab /etc/cron.*/*
service cron start
CONTAINER_ALREADY_STARTED="CONTAINER_ALREADY_STARTED_PLACEHOLDER"
if [ ! -e $CONTAINER_ALREADY_STARTED ]; then
touch $CONTAINER_ALREADY_STARTED
echo "-- First container startup --"
FILE1=/var/www/html/assets/data/database.db
FILE2=/var/www/html/assets/data/version.txt
DIRECTORY=/var/www/html/assets/data/avatars
if [ ! -f "$FILE1" ]; then
echo "-- Create Database --"
cp /var/www/html/dbase.sample.db "$FILE1"
chown www-data:www-data "$FILE1"
echo "For first login use:"
echo
echo "Username: demo"
echo "Password: demo"
fi
if [ ! -f "$FILE2" ]; then
echo "$_VERSION" > "$FILE2"
fi
if [ ! -d "$DIRECTORY" ]; then
mkdir -p "$DIRECTORY"
chown www-data:www-data "$DIRECTORY"
fi
fi
if [ -x "$(command -v usermod)" ] ; then
echo "-- Change www-data to user id: $UID --"
usermod -u "${UID}" www-data
echo "-- Change www-data to group id: $GID --"
groupmod -g "${GID}" www-data
echo "-- Activate cronjob --"
crontab /etc/cron.d/somo
fi
chown -R www-data:www-data /var/www/html/assets/data
exec apache2-foreground