diff options
| author | Chen Qi <Qi.Chen@windriver.com> | 2023-06-13 02:49:31 -0700 |
|---|---|---|
| committer | Khem Raj <raj.khem@gmail.com> | 2023-06-14 09:41:35 -0700 |
| commit | 3c9494fb772bcb7dc66ed10685d41b82a58377c7 (patch) | |
| tree | 9b357f0a8cfde67056021d2286a1453c62cd08b0 /meta-oe/recipes-extended/redis/redis-7.0.11/init-redis-server | |
| parent | c6581c7179d64cc49221be7284c974d0235d9c9a (diff) | |
| download | meta-openembedded-3c9494fb772bcb7dc66ed10685d41b82a58377c7.tar.gz | |
redis: use the files path correctly
Recipes are not expected to set FILESPATH directly, they are
expected to use FILESEXTRAPATH.
I can see the seting of FILESPATH in this recipe only wants to
find redis-7 specific patches and files. This could be easily achieved by
using redis-7.0.11/ directory to hold all those files.
Using FILESPATH in this way removes the possibility of overriding
some files (e.g., the redis service file) from other layers via
FILESEXTRAPATH:prepend, which is kind of a common practice and is
actually working for basically all other recipes.
This is because we have:
meta/classes-global/base.bbclass:FILESPATH = "${@base_set_filespath(["${FILE_DIRNAME}/${BP}", "${FILE_DIRNAME}/${BPN}", "${FILE_DIRNAME}/files"], d)}"
And FILESEXTRAPATH is handled in base_set_filespath.
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'meta-oe/recipes-extended/redis/redis-7.0.11/init-redis-server')
| -rwxr-xr-x | meta-oe/recipes-extended/redis/redis-7.0.11/init-redis-server | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/meta-oe/recipes-extended/redis/redis-7.0.11/init-redis-server b/meta-oe/recipes-extended/redis/redis-7.0.11/init-redis-server new file mode 100755 index 0000000000..c5f335f57d --- /dev/null +++ b/meta-oe/recipes-extended/redis/redis-7.0.11/init-redis-server | |||
| @@ -0,0 +1,71 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | # | ||
| 3 | ### BEGIN INIT INFO | ||
| 4 | # Provides: redis-server | ||
| 5 | # Required-Start: $network | ||
| 6 | # Required-Stop: $network | ||
| 7 | # Default-Start: S 2 3 4 5 | ||
| 8 | # Default-Stop: 0 1 6 | ||
| 9 | # Short-Description: Redis, a key-value store | ||
| 10 | # Description: Redis is an open source, advanced key-value store. | ||
| 11 | # http://redis.io | ||
| 12 | ### END INIT INFO | ||
| 13 | |||
| 14 | test -f /usr/bin/redis-server || exit 0 | ||
| 15 | |||
| 16 | ARGS="/etc/redis/redis.conf" | ||
| 17 | |||
| 18 | case "$1" in | ||
| 19 | start) | ||
| 20 | echo "Starting redis-server..." | ||
| 21 | start-stop-daemon --start --quiet --exec /usr/bin/redis-server -- $ARGS | ||
| 22 | ;; | ||
| 23 | stop) | ||
| 24 | echo "Stopping redis-server..." | ||
| 25 | start-stop-daemon --stop --quiet --exec /usr/bin/redis-server | ||
| 26 | ;; | ||
| 27 | restart) | ||
| 28 | echo "Stopping redis-server..." | ||
| 29 | start-stop-daemon --stop --quiet --exec /usr/bin/redis-server | ||
| 30 | |||
| 31 | # Since busybox implementation ignores --retry arguments repeatedly check | ||
| 32 | # if the process is still running and try another signal after a timeout, | ||
| 33 | # efectively simulating a stop with --retry=TERM/5/KILL/5 schedule. | ||
| 34 | waitAfterTerm=5000000 # us / 5000 ms / 5 s | ||
| 35 | waitAfterKill=5000000 # us / 5000 ms / 5 s | ||
| 36 | waitStep=100000 # us / 100 ms / 0.1 s | ||
| 37 | waited=0 | ||
| 38 | start-stop-daemon --stop --test --quiet --exec /usr/bin/redis-server | ||
| 39 | processOff=$? | ||
| 40 | while [ $processOff -eq 0 ] && [ $waited -le $waitAfterTerm ] ; do | ||
| 41 | usleep ${waitStep} | ||
| 42 | ((waited+=${waitStep})) | ||
| 43 | start-stop-daemon --stop --test --quiet --exec /usr/bin/redis-server | ||
| 44 | processOff=$? | ||
| 45 | done | ||
| 46 | if [ $processOff -eq 0 ] ; then | ||
| 47 | start-stop-daemon --stop --signal KILL --exec /usr/bin/redis-server | ||
| 48 | start-stop-daemon --stop --test --quiet --exec /usr/bin/redis-server | ||
| 49 | processOff=$? | ||
| 50 | fi | ||
| 51 | waited=0 | ||
| 52 | while [ $processOff -eq 0 ] && [ $waited -le $waitAfterKill ] ; do | ||
| 53 | usleep ${waitStep} | ||
| 54 | ((waited+=${waitStep})) | ||
| 55 | start-stop-daemon --stop --test --quiet --exec /usr/bin/redis-server | ||
| 56 | processOff=$? | ||
| 57 | done | ||
| 58 | # Here $processOff will indicate if waiting and retrying according to | ||
| 59 | # the schedule ended in a successfull stop or not. | ||
| 60 | |||
| 61 | echo "Starting redis-server..." | ||
| 62 | start-stop-daemon --start --quiet --exec /usr/bin/redis-server -- $ARGS | ||
| 63 | ;; | ||
| 64 | *) | ||
| 65 | echo "Usage: /etc/init.d/redis-server {start|stop|restart}" | ||
| 66 | exit 1 | ||
| 67 | ;; | ||
| 68 | esac | ||
| 69 | |||
| 70 | exit 0 | ||
| 71 | |||
