forked from msimerson/Mail-Toaster-6
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprovision-redis.sh
executable file
·56 lines (46 loc) · 1.17 KB
/
provision-redis.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
#!/bin/sh
# shellcheck disable=1091
. mail-toaster.sh || exit
export JAIL_START_EXTRA=""
export JAIL_CONF_EXTRA=""
install_redis()
{
tell_status "installing redis"
stage_pkg_install redis || exit
}
configure_redis()
{
tell_status "configuring redis"
mkdir -p "$STAGE_MNT/data/db" "$STAGE_MNT/data/log" \
"$STAGE_MNT/usr/local/etc/newsyslog.conf.d" || exit
stage_exec chown redis:redis /data/db /data/log || exit
sed -i .bak \
-e '/^stop-writes-on-bgsave-error/ s/yes/no/' \
-e 's/^dir \/var\/db\/redis\//dir \/data\/db\//' \
-e 's/^# syslog-enabled no/syslog-enabled yes/' \
-e 's/^logfile .*/logfile \/data\/log\/redis.log/' \
"$STAGE_MNT/usr/local/etc/redis.conf"
echo '/data/log/redis.log redis:redis 644 7 * @T00 JC /var/run/redis/redis.pid' \
> "$STAGE_MNT/usr/local/etc/newsyslog.conf.d/redis"
}
start_redis()
{
tell_status "starting redis"
stage_sysrc redis_enable=YES
stage_exec service redis start
}
test_redis()
{
echo "testing redis"
sleep 1
stage_listening 6379
echo "it worked"
}
base_snapshot_exists || exit
create_staged_fs redis
start_staged_jail redis
install_redis
configure_redis
start_redis
test_redis
promote_staged_jail redis