service
Ubuntu 16.04.6 LTSでは、コマンドを呼び出してサービスの状態を変更する方法はありません。/etc/init/
コマンドが開始されましたが、実行中に中断されました。
サービス自体はまだ実行中ですが、独自の構成(start on
など)に応じて
その中のスクリプトと/etc/init.d
やり取りできます。
には何もなく、/var/log/syslog
サービス別ログ( )/var/log/upstart/<service>.log
には特別な内容がありません。
initctl -v reload-configuration
コマンドも中断され、何も印刷しません。
以下を使って追加したinitスクリプトの構文を確認しましたが、次のinit-checkconf
ように出力されました。
DEBUG: upstart_path=/sbin/upstart
DEBUG: initctl_path=/sbin/initctl
DEBUG: Setting XDG_RUNTIME_DIR='/tmp/init-checkconf.fbn15XHMSG'
DEBUG: confdir=/tmp/init-checkconf.1ZAjdLCNnz
DEBUG: file=/etc/init/tiler.conf
DEBUG: job=tiler
DEBUG: upstart_out=/tmp/init-checkconf-upstart-output.KbilFI2A3x
DEBUG: upstart_cmd=/sbin/upstart --user --no-dbus --no-startup-event --verbose --confdir /tmp/init-checkconf.1ZAjdLCNnz
DEBUG: Upstart pid=32001
DEBUG: Joining Upstart session 'unix:abstract=/com/ubuntu/upstart-session/0/32001'
DEBUG: Waiting for Upstart to initialise (attempt 1)
DEBUG: Secondary Upstart (/sbin/upstart --user --no-dbus --no-startup-event --verbose --confdir /tmp/init-checkconf.1ZAjdLCNnz) running with PID 32001
File /etc/init/tiler.conf: syntax ok
DEBUG: Stopping secondary Upstart (running with PID 32001)
そして、基本スクリプトであるnginxスクリプトを使用します。
DEBUG: upstart_path=/sbin/upstart
DEBUG: initctl_path=/sbin/initctl
DEBUG: Setting XDG_RUNTIME_DIR='/tmp/init-checkconf.bk34MF5r1W'
DEBUG: confdir=/tmp/init-checkconf.1aWnCVHKEp
DEBUG: file=/etc/init/nginx.conf
DEBUG: job=nginx
DEBUG: upstart_out=/tmp/init-checkconf-upstart-output.n7w9BHFOsL
DEBUG: upstart_cmd=/sbin/upstart --user --no-dbus --no-startup-event --verbose --confdir /tmp/init-checkconf.1aWnCVHKEp
DEBUG: Upstart pid=32107
DEBUG: Joining Upstart session 'unix:abstract=/com/ubuntu/upstart-session/0/32107'
DEBUG: Waiting for Upstart to initialise (attempt 1)
DEBUG: Secondary Upstart (/sbin/upstart --user --no-dbus --no-startup-event --verbose --confdir /tmp/init-checkconf.1aWnCVHKEp) running with PID 32107
File /etc/init/nginx.conf: syntax ok
DEBUG: Stopping secondary Upstart (running with PID 32107)
この問題の原因は何ですか?どうやって解決しますか?
時間をいただきありがとうございます
ポリスチレンstrace
ランタイムログですservice tiler restart
execve("/usr/sbin/service", ["service", "tiler", "restart"], [/* 19 vars */]) = 0
brk(NULL) = 0x55b3bcb00000
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
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=61892, ...}) = 0
mmap(NULL, 61892, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fee7dfe1000
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\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0`\t\2\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=1868984, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fee7dfe0000
mmap(NULL, 3971488, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fee7da02000
mprotect(0x7fee7dbc2000, 2097152, PROT_NONE) = 0
mmap(0x7fee7ddc2000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1c0000) = 0x7fee7ddc2000
mmap(0x7fee7ddc8000, 14752, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fee7ddc8000
close(3) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fee7dfdf000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fee7dfde000
arch_prctl(ARCH_SET_FS, 0x7fee7dfdf700) = 0
mprotect(0x7fee7ddc2000, 16384, PROT_READ) = 0
mprotect(0x55b3bc08e000, 8192, PROT_READ) = 0
mprotect(0x7fee7dff1000, 4096, PROT_READ) = 0
munmap(0x7fee7dfe1000, 61892) = 0
getuid() = 0
getgid() = 0
getpid() = 5537
rt_sigaction(SIGCHLD, {0x55b3bbe82540, ~[RTMIN RT_1], SA_RESTORER, 0x7fee7da374c0}, NULL, 8) = 0
geteuid() = 0
brk(NULL) = 0x55b3bcb00000
brk(0x55b3bcb21000) = 0x55b3bcb21000
getppid() = 5535
stat("/home/ubuntu", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
stat(".", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
open("/usr/sbin/service", O_RDONLY) = 3
fcntl(3, F_DUPFD, 10) = 10
close(3) = 0
fcntl(10, F_SETFD, FD_CLOEXEC) = 0
geteuid() = 0
getegid() = 0
rt_sigaction(SIGINT, NULL, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGINT, {0x55b3bbe82540, ~[RTMIN RT_1], SA_RESTORER, 0x7fee7da374c0}, NULL, 8) = 0
rt_sigaction(SIGQUIT, NULL, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGQUIT, {SIG_DFL, ~[RTMIN RT_1], SA_RESTORER, 0x7fee7da374c0}, NULL, 8) = 0
rt_sigaction(SIGTERM, NULL, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGTERM, {SIG_DFL, ~[RTMIN RT_1], SA_RESTORER, 0x7fee7da374c0}, NULL, 8) = 0
read(10, "#!/bin/sh\n\n#####################"..., 8192) = 8192
pipe([3, 4]) = 0
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7fee7dfdf9d0) = 5538
close(4) = 0
read(3, "service\n", 128) = 8
read(3, "", 128) = 0
close(3) = 0
wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 5538
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=5538, si_uid=0, si_status=0, si_utime=0, si_stime=0} ---
rt_sigreturn({mask=[]}) = 5538
pipe([3, 4]) = 0
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7fee7dfdf9d0) = 5539
close(4) = 0
read(3, "service\n", 128) = 8
read(3, "", 128) = 0
close(3) = 0
wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 5539
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=5539, si_uid=0, si_status=0, si_utime=0, si_stime=0} ---
rt_sigreturn({mask=[]}) = 5539
stat("/run/systemd/system", 0x7ffdc59d9e90) = -1 ENOENT (No such file or directory)
chdir("/") = 0
faccessat(AT_FDCWD, "/etc/init/tiler.conf", R_OK) = 0
open("/dev/null", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 3
fcntl(1, F_DUPFD, 10) = 11
close(1) = 0
fcntl(11, F_SETFD, FD_CLOEXEC) = 0
dup2(3, 1) = 1
close(3) = 0
stat("/usr/local/sbin/which", 0x7ffdc59d9fa0) = -1 ENOENT (No such file or directory)
stat("/usr/local/bin/which", 0x7ffdc59d9fa0) = -1 ENOENT (No such file or directory)
stat("/usr/sbin/which", 0x7ffdc59d9fa0) = -1 ENOENT (No such file or directory)
stat("/usr/bin/which", {st_mode=S_IFREG|0755, st_size=946, ...}) = 0
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7fee7dfdf9d0) = 5540
wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 5540
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=5540, si_uid=0, si_status=0, si_utime=0, si_stime=0} ---
rt_sigreturn({mask=[]}) = 5540
dup2(11, 1) = 1
close(11) = 0
stat("/usr/local/sbin/initctl", 0x7ffdc59da030) = -1 ENOENT (No such file or directory)
stat("/usr/local/bin/initctl", 0x7ffdc59da030) = -1 ENOENT (No such file or directory)
stat("/usr/sbin/initctl", 0x7ffdc59da030) = -1 ENOENT (No such file or directory)
stat("/usr/bin/initctl", 0x7ffdc59da030) = -1 ENOENT (No such file or directory)
stat("/sbin/initctl", {st_mode=S_IFREG|0755, st_size=214216, ...}) = 0
pipe([3, 4]) = 0
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7fee7dfdf9d0) = 5541
close(4) = 0
stat("/usr/local/sbin/grep", 0x7ffdc59da030) = -1 ENOENT (No such file or directory)
stat("/usr/local/bin/grep", 0x7ffdc59da030) = -1 ENOENT (No such file or directory)
stat("/usr/sbin/grep", 0x7ffdc59da030) = -1 ENOENT (No such file or directory)
stat("/usr/bin/grep", 0x7ffdc59da030) = -1 ENOENT (No such file or directory)
stat("/sbin/grep", 0x7ffdc59da030) = -1 ENOENT (No such file or directory)
stat("/bin/grep", {st_mode=S_IFREG|0755, st_size=211224, ...}) = 0
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7fee7dfdf9d0) = 5542
close(3) = 0
close(-1) = -1 EBADF (Bad file descriptor)
wait4(-1, 0x7ffdc59d9f5c, 0, NULL) = ? ERESTARTSYS (To be restarted if SA_RESTART is set)
--- SIGINT {si_signo=SIGINT, si_code=SI_KERNEL} ---
rt_sigreturn({mask=[]}) = -1 EINTR (Interrupted system call)
wait4(-1, [{WIFSIGNALED(s) && WTERMSIG(s) == SIGINT}], 0, NULL) = 5542
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_KILLED, si_pid=5542, si_uid=0, si_status=SIGINT, si_utime=0, si_stime=0} ---
rt_sigreturn({mask=[]}) = 5542
wait4(-1, [{WIFSIGNALED(s) && WTERMSIG(s) == SIGINT}], 0, NULL) = 5541
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_KILLED, si_pid=5541, si_uid=0, si_status=SIGINT, si_utime=0, si_stime=0} ---
rt_sigreturn({mask=[]}) = 5541
rt_sigprocmask(SIG_SETMASK, [], [], 8) = 0
rt_sigaction(SIGINT, {SIG_DFL, [INT], SA_RESTORER|SA_RESTART, 0x7fee7da374c0}, {0x55b3bbe82540, ~[KILL STOP RTMIN RT_1], SA_RESTORER, 0x7fee7da374c0}, 8) = 0
tgkill(5537, 5537, SIGINT) = 0
--- SIGINT {si_signo=SIGINT, si_code=SI_TKILL, si_pid=5537, si_uid=0} ---
+++ killed by SIGINT +++
スタンバイモードで停止しています。
また、Journalctlには何もありません。
答え1
わかりましたが、RAMが不足してプロセスを強制的に停止したインスタンスでした。