This repository has been archived by the owner on Dec 6, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add: script for setup of redis binary service
- Loading branch information
1 parent
8363a8a
commit 44fb5a4
Showing
1 changed file
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/usr/bin/env bash | ||
# Usage: setup-redis.sh | ||
set -eEuo pipefail | ||
|
||
tmpdir="${PREM_APPDIR:-.}/redis" | ||
|
||
cleanup(){ | ||
for i in $(jobs -p); do | ||
kill -n 9 $i || : | ||
done | ||
rm -rf "$tmpdir" | ||
exit 0 | ||
} | ||
|
||
trap "cleanup" SIGTERM | ||
trap "cleanup" SIGINT | ||
trap "cleanup" ERR | ||
|
||
arch_type=$(uname -m) | ||
case "$arch_type" in | ||
"x86_64") | ||
arch_suffix="catalina.x86_64" | ||
;; | ||
"arm64") | ||
arch_suffix="monterey.arm64" | ||
;; | ||
*) | ||
echo "Unsupported architecture: $arch_type" | ||
exit 1 | ||
;; | ||
esac | ||
url="https://packages.redis.io/redis-stack/redis-stack-server-7.2.0-v6.$arch_suffix.zip" | ||
|
||
mkdir -p "$tmpdir" | ||
wget "$url" -O "$tmpdir/redis-stack-server.zip" | ||
|
||
unzip -d "$tmpdir" "$tmpdir/redis-stack-server.zip" | ||
|
||
PATH="$tmpdir:$PATH" "$tmpdir/bin/redis-stack-server" & | ||
|
||
wait |