forked from lloesche/valheim-server-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
valheim-bootstrap
executable file
·69 lines (54 loc) · 2.16 KB
/
valheim-bootstrap
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
60
61
62
63
64
65
66
67
68
69
#!/bin/bash
# Include defaults
. /usr/local/etc/valheim/defaults
. /usr/local/etc/valheim/common
mkdir -p "$valheim_download_path"
mkdir -p "$valheim_install_path"
if [ "$VALHEIM_PLUS" = true ]; then
mkdir -p "$vp_download_path"
mkdir -p "$vp_install_path"
fi
if [ -f "/usr/share/zoneinfo/$TZ" ]; then
echo "Setting timezone $TZ"
ln -snf /usr/share/zoneinfo/$TZ /etc/localtime
echo "$TZ" > /etc/timezone
else
echo "Error: unknown timezone $TZ"
fi
crontab=$(mktemp)
if [ "$BACKUPS" = true -a -n "$BACKUPS_CRON" -a "$BACKUPS_INTERVAL" = "315360000" ]; then
echo "Creating cron to do world backups using schedule $BACKUPS_CRON"
tmpfile=$(mktemp)
echo "$BACKUPS_CRON [ -f $valheim_backup_pidfile ] && kill -HUP \$(cat $valheim_backup_pidfile)" >> $crontab
fi
if [ -n "$UPDATE_CRON" -a "$UPDATE_INTERVAL" = "315360000" ]; then
echo "Creating cron to check for updates using schedule $UPDATE_CRON"
tmpfile=$(mktemp)
echo "$UPDATE_CRON [ -f $valheim_updater_pidfile ] && kill -HUP \$(cat $valheim_updater_pidfile)" >> $crontab
fi
if [ -n "$RESTART_CRON" ]; then
echo "Creating cron to restart valheim-server using schedule $RESTART_CRON"
tmpfile=$(mktemp)
echo "$RESTART_CRON /usr/bin/supervisorctl restart valheim-server" >> $crontab
else
echo "Environment variable RESTART_CRON is empty - no automatic valheim-server restart scheduled"
fi
crontab $crontab
rm -f $crontab
# Notify users of new data paths
if [ -d "/opt/valheim_dl" -o -f "/opt/valheim/valheim_server.x86_64" ]; then
cat <<EOF
!!! ATTENTION !!!
You have /opt/valheim_dl mounted or old server files in /opt/valheim.
The /opt/valheim_dl volume is no longer required and has been unified under
/opt/valheim
Directories have been moved in the following way:
/opt/valheim/ -> /opt/valheim/server/
/opt/valheim_dl/ -> /opt/valheim/dl/server/
You might want to (re)move existing files or create a fresh volume mount under /opt/valheim to clean things up.
Nothing is going to break though if you don't. It will just consume some extra disk space.
If required we'll download a fresh copy of the server in the new directory structure.
!!! ATTENTION !!!
EOF
fi
exit 0