svscan/supervise에 의해 실행되고 모니터링되는 스크립트가 있습니다. 마지막 때
luces -hf/run:
#!/bin/bash
set -v
export http_proxy=[redacted]
curl -N -s https://[redacted] |\
grep --line-buffered "event" | http_proxy='' xargs -n 1 luces.sh
스크립트가 시작되고 luces.sh
스크립트가 중단되어 좀비 상태로 유지되면 전체 파이프라인이 계속 실행되는 것 같습니다. 스크립트가 완료되고 감독에 의해 다시 시작되도록 실패하기를 원합니다.
프로세스 트리는 다음과 같습니다.
24788 ? Ss 0:00 /bin/sh /usr/bin/svscanboot
24790 ? S 0:01 \_ svscan /etc/service
24794 ? S 0:00 | \_ supervise luces-hf
29876 ? S 0:00 | | \_ /bin/bash ./run
29877 ? S 0:00 | | \_ curl -N -s https://[redacted][long request never endind. server sent events one line at a time]
29878 ? S 0:00 | | \_ grep --line-buffered event
29879 ? S 0:00 | | \_ xargs -n 1 luces.sh
5885 ? Z 0:00 | | \_ [luces.sh] <defunct>
편집하다: luces.sh
컬을 사용하여 세 개의 http 요청을 수행합니다.
편집하다: 스크립트에서 xargs 명령의 strace 출력:
execve("/usr/bin/xargs", ["xargs", "-n", "1", "luces.sh"], [/* 6 vars */]) = 0
brk(0) = 0x1d07000
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fad73c49000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=43357, ...}) = 0
mmap(NULL, 43357, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fad73c3e000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\320\37\2\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=1840928, ...}) = 0
mmap(NULL, 3949248, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fad73664000
mprotect(0x7fad7381f000, 2093056, PROT_NONE) = 0
mmap(0x7fad73a1e000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1ba000) = 0x7fad73a1e000
mmap(0x7fad73a24000, 17088, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fad73a24000
close(3) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fad73c3d000
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fad73c3b000
arch_prctl(ARCH_SET_FS, 0x7fad73c3b740) = 0
mprotect(0x7fad73a1e000, 16384, PROT_READ) = 0
mprotect(0x609000, 4096, PROT_READ) = 0
mprotect(0x7fad73c4b000, 4096, PROT_READ) = 0
munmap(0x7fad73c3e000, 43357) = 0
brk(0) = 0x1d07000
brk(0x1d28000) = 0x1d28000
getrlimit(RLIMIT_STACK, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 0
getrlimit(RLIMIT_STACK, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 0
mmap(NULL, 135168, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fad73c1a000
rt_sigaction(SIGCHLD, {SIG_DFL, [CHLD], SA_RESTORER|SA_RESTART, 0x7fad7369ad40}, {SIG_DFL, [], 0}, 8) = 0
fstat(0, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fad73c48000
read(0, "event: HF\n", 4096) = 10
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7fad73c3ba10) = 16952
wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 16952
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=16952, si_status=0, si_utime=0, si_stime=0} ---
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7fad73c3ba10) = 16968
read(0, 0x7fad73c48000, 4096) = ? ERESTARTSYS (To be restarted if SA_RESTART is set)
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=16968, si_status=0, si_utime=0, si_stime=0} ---
read(0, "event: HF\n", 4096) = 10
wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 16968
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7fad73c3ba10) = 17023
wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 17023
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=17023, si_status=0, si_utime=0, si_stime=0} ---
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7fad73c3ba10) = 17040
read(0, 0x7fad73c48000, 4096) = ? ERESTARTSYS (To be restarted if SA_RESTART is set)
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=17040, si_status=0, si_utime=0, si_stime=0} ---
read(0, "event: HF\n", 4096) = 10
wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 17040
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7fad73c3ba10) = 17065
wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 17065
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=17065, si_status=0, si_utime=0, si_stime=0} ---
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7fad73c3ba10) = 17087
read(0, 0x7fad73c48000, 4096) = ? ERESTARTSYS (To be restarted if SA_RESTART is set)
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=17087, si_status=0, si_utime=0, si_stime=0} ---
read(0, "event: HF\n", 4096) = 10
wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 17087
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7fad73c3ba10) = 17127
wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 17127
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=17127, si_status=0, si_utime=0, si_stime=0} ---
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7fad73c3ba10) = 17147
read(0, 0x7fad73c48000, 4096) = ? ERESTARTSYS (To be restarted if SA_RESTART is set)
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=17147, si_status=0, si_utime=0, si_stime=0} ---
read(0, "event: HF\n", 4096) = 10
wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 17147
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7fad73c3ba10) = 17274
wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 17274
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=17274, si_status=0, si_utime=0, si_stime=0} ---
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7fad73c3ba10) = 17293
read(0, 0x7fad73c48000, 4096) = ? ERESTARTSYS (To be restarted if SA_RESTART is set)
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=17293, si_status=0, si_utime=0, si_stime=0} ---