대화 형 쉘에서 주간 서버에 연결하기 위해 텔넷을 호출하면 정상적으로 작동합니다. 그러나 cron 또는 일부 bash 데몬 프로세스가 실행하는 쉘 스크립트에서 동일한 텔넷 호출이 발행되면 출력을 생성하지 못합니다. 두 호출을 모두 추적했으며 여기에 있습니다.
성공적인 것 :
execve("/usr/bin/telnet", ["telnet", "192.168.0.11", "13"], [/* 24 vars */]) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|0x4000000, -1, 0) = 0x40005000
stat("/etc/ld.so.cache", {st_mode=S_IFREG|0644, st_size=3128, ...}) = 0
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
mmap2(NULL, 3128, PROT_READ, MAP_SHARED, 3, 0) = 0x40006000
close(3) = 0
stat("/etc/ld.so.preload", 0xbea5d8d4) = -1 ENOENT (No such file or directory)
open("/lib/libc.so.0", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0755, st_size=324423, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|0x4000000, -1, 0) = 0x40007000
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0\320\253\0\0004\0\0\0\0"..., 4096) = 4096
mmap2(NULL, 376832, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x4000e000
mmap2(0x4000e000, 319264, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3, 0) = 0x4000e000
mmap2(0x40064000, 4935, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x4e) = 0x40064000
mmap2(0x40066000, 14712, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x40066000
close(3) = 0
munmap(0x40007000, 4096) = 0
munmap(0x40006000, 3128) = 0
stat("/lib/ld-uClibc.so.0", {st_mode=S_IFREG|0755, st_size=20486, ...}) = 0
mprotect(0x40064000, 4096, PROT_READ) = 0
mprotect(0x4000c000, 4096, PROT_READ) = 0
ioctl(0, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo ...}) = 0
ioctl(1, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo ...}) = 0
getuid32() = 0
ioctl(0, TIOCGWINSZ, {ws_row=55, ws_col=203, ws_xpixel=0, ws_ypixel=0}) = 0
ioctl(0, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo ...}) = 0
brk(0) = 0x91000
brk(0x92000) = 0x92000
socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 3
setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
connect(3, {sa_family=AF_INET, sin_port=htons(13), sin_addr=inet_addr("192.168.0.11")}, 16) = 0
setsockopt(3, SOL_SOCKET, SO_KEEPALIVE, [1], 4) = 0
rt_sigaction(SIGINT, {0x667c0, [INT], SA_RESTART|0x4000000}, {SIG_DFL, [], 0}, 8) = 0
poll([{fd=0, events=POLLIN}, {fd=3, events=POLLIN}], 2, -1) = 1 ([{fd=3, revents=POLLIN}])
read(3, "Wed Apr 27 11:42:10 2011\r\n"..., 128) = 26
write(1, "Wed Apr 27 11:42:10 2011\r\n"..., 26) = 26
poll([{fd=0, events=POLLIN}, {fd=3, events=POLLIN}], 2, -1) = 1 ([{fd=3, revents=POLLIN}])
read(3, ""..., 128) = 0
write(1, "Connection closed by foreign host"..., 35) = 35
ioctl(0, SNDCTL_TMR_STOP or TCSETSW, {B38400 opost isig icanon echo ...}) = 0
exit(1) = ?
실패한 것 :
execve("/usr/bin/telnet", ["/usr/bin/telnet", "192.168.0.11", "13"], [/* 22 vars */]) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|0x4000000, -1, 0) = 0x40005000
stat("/etc/ld.so.cache", {st_mode=S_IFREG|0644, st_size=3128, ...}) = 0
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
mmap2(NULL, 3128, PROT_READ, MAP_SHARED, 3, 0) = 0x40006000
close(3) = 0
stat("/etc/ld.so.preload", 0xbe90a8f4) = -1 ENOENT (No such file or directory)
open("/lib/libc.so.0", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0755, st_size=324423, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|0x4000000, -1, 0) = 0x40007000
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0\320\253\0\0004\0\0\0\0"..., 4096) = 4096
mmap2(NULL, 376832, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x4000e000
mmap2(0x4000e000, 319264, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3, 0) = 0x4000e000
mmap2(0x40064000, 4935, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x4e) = 0x40064000
mmap2(0x40066000, 14712, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x40066000
close(3) = 0
munmap(0x40007000, 4096) = 0
munmap(0x40006000, 3128) = 0
stat("/lib/ld-uClibc.so.0", {st_mode=S_IFREG|0755, st_size=20486, ...}) = 0
mprotect(0x40064000, 4096, PROT_READ) = 0
mprotect(0x4000c000, 4096, PROT_READ) = 0
ioctl(0, SNDCTL_TMR_TIMEBASE or TCGETS, 0xbe90a714) = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(1, SNDCTL_TMR_TIMEBASE or TCGETS, 0xbe90a714) = -1 ENOTTY (Inappropriate ioctl for device)
getuid32() = 0
ioctl(0, TIOCGWINSZ, 0xbe90a9cc) = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(0, SNDCTL_TMR_TIMEBASE or TCGETS, 0xbe90a9b4) = -1 ENOTTY (Inappropriate ioctl for device)
brk(0) = 0x91000
brk(0x92000) = 0x92000
socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 3
setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
connect(3, {sa_family=AF_INET, sin_port=htons(13), sin_addr=inet_addr("192.168.0.11")}, 16) = 0
setsockopt(3, SOL_SOCKET, SO_KEEPALIVE, [1], 4) = 0
rt_sigaction(SIGINT, {0x667c0, [INT], SA_RESTART|0x4000000}, {SIG_DFL, [], 0}, 8) = 0
poll([{fd=0, events=POLLIN}, {fd=3, events=POLLIN}], 2, -1) = 2 ([{fd=0, revents=POLLIN}, {fd=3, revents=POLLIN}])
read(0, ""..., 128) = 0
exit(0) = ?
도움을 환영합니다.
나는 당신이 희망 할 수 없습니다 때, 시스템 클럭을 조정하려면이 옵션을 사용하여 더 나은 솔루션을 이미 사용할 수 있습니다.
—
grawity