UnisKB/installer/start-redis.sh

39 lines
868 B
Bash
Raw Permalink Normal View History

2025-04-18 06:10:16 +00:00
#!/bin/bash
2025-08-12 02:44:51 +00:00
if [ ! -d /opt/maxkb/data/redis ]; then
mkdir -p /opt/maxkb/data/redis
chmod 700 /opt/maxkb/data/redis
fi
2025-08-12 03:13:51 +00:00
if [ ! -d /opt/maxkb/logs ]; then
mkdir -p /opt/maxkb/logs
chmod 700 /opt/maxkb/logs
fi
2025-04-18 06:10:16 +00:00
if [ ! -f /opt/maxkb/conf/redis.conf ]; then
mkdir -p /opt/maxkb/conf
touch /opt/maxkb/conf/redis.conf
2025-08-12 02:44:51 +00:00
chmod 700 /opt/maxkb/conf/redis.conf
2025-07-07 02:33:00 +00:00
cat <<EOF > /opt/maxkb/conf/redis.conf
bind 0.0.0.0
port 6379
databases 16
maxmemory 1G
aof-use-rdb-preamble yes
save 30 1
save 10 10
save 5 20
dbfilename dump.rdb
rdbcompression yes
appendonly yes
appendfilename "appendonly.aof"
appendfsync everysec
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
maxmemory-policy allkeys-lru
loglevel warning
logfile /opt/maxkb/logs/redis.log
dir /opt/maxkb/data/redis
requirepass ${REDIS_PASSWORD}
EOF
2025-04-18 06:10:16 +00:00
fi
2025-04-21 07:39:29 +00:00
redis-server /opt/maxkb/conf/redis.conf