teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

3

追加確認事項

2017/09/17 23:32

投稿

nagog
nagog

スコア16

title CHANGED
File without changes
body CHANGED
@@ -32,70 +32,7 @@
32
32
  ```
33
33
  リストを見てもenableでした。
34
34
  ```
35
- UNIT FILE STATE
35
+ UNIT FILE STATE
36
- alsa-restore.service static
37
- alsa-state.service static
38
- alsa-store.service static
39
- alsa-utils.service masked
40
- autologin@.service enabled
41
- autovt@.service disabled
42
- avahi-daemon.service enabled
43
- bluetooth.service enabled
44
- bootlogd.service masked
45
- bootlogs.service masked
46
- bootmisc.service masked
47
- checkfs.service masked
48
- checkroot-bootclean.service masked
49
- checkroot.service masked
50
- console-getty.service disabled
51
- console-shell.service disabled
52
- container-getty@.service static
53
- cron.service enabled
54
- cryptdisks-early.service masked
55
- cryptdisks.service masked
56
- dbus-org.bluez.service enabled
57
- dbus-org.freedesktop.Avahi.service enabled
58
- dbus-org.freedesktop.hostname1.service static
59
- dbus-org.freedesktop.locale1.service static
60
- dbus-org.freedesktop.login1.service static
61
- dbus-org.freedesktop.machine1.service static
62
- dbus-org.freedesktop.timedate1.service static
63
- dbus.service static
64
- debian-fixup.service static
65
- debug-shell.service disabled
66
- dhcpcd.service enabled
67
- display-manager.service enabled
68
- emergency.service static
69
- fake-hwclock.service enabled
70
- fuse.service masked
71
- getty-static.service static
72
- getty@.service disabled
73
- halt-local.service static
74
- halt.service masked
75
- hciuart.service enabled
76
- hostname.service masked
77
- hwclock-save.service enabled
78
- hwclock.service masked
79
- hwclockfirst.service masked
80
- ifup@.service static
81
- initrd-cleanup.service static
82
- initrd-parse-etc.service static
83
- initrd-switch-root.service static
84
- initrd-udevadm-cleanup-db.service static
85
- killprocs.service masked
86
- kmod-static-nodes.service static
87
- kmod.service static
88
- lightdm.service enabled
89
- module-init-tools.service static
90
- motd.service masked
91
- mountall-bootclean.service masked
92
- mountall.service masked
93
- mountdevsubfs.service masked
94
- mountkernfs.service masked
95
- mountnfs-bootclean.service masked
96
- mountnfs.service masked
97
- nodered.service disabled
98
- packagekit-offline-update.service static
99
36
  packagekit.service static
100
37
  pigpiod.service disabled
101
38
  plymouth-halt.service static
@@ -115,22 +52,7 @@
115
52
  rc-local.service static
116
53
  rc.local.service static
117
54
  reboot.service masked
118
- rescue.service static
55
+ rescue.service static
119
- rmnologin.service masked
120
- rpi-display-backlight.service enabled
121
- rsync.service disabled
122
- rsyslog.service enabled
123
- rtkit-daemon.service disabled
124
- samba.service masked
125
- sendsigs.service masked
126
- serial-getty@.service disabled
127
- single.service masked
128
- ssh.service enabled
129
- ssh@.service static
130
- sshswitch.service enabled
131
- stop-bootlogd-single.service masked
132
- stop-bootlogd.service masked
133
- sudo.service disabled
134
56
  syslog.service enabled
135
57
  systemd-ask-password-console.service static
136
58
  systemd-ask-password-plymouth.service static
@@ -184,17 +106,6 @@
184
106
  test2.service enabled
185
107
  udev-finish.service static
186
108
  udev.service static
187
- udisks2.service static
188
- umountfs.service masked
189
- umountnfs.service masked
190
- umountroot.service masked
191
- urandom.service static
192
- usb_modeswitch@.service static
193
- user@.service static
194
- vncserver-virtuald.service disabled
195
- vncserver-x11-serviced.service enabled
196
- wpa_supplicant.service disabled
197
- x11-common.service masked
198
109
  ```
199
110
  最初は動いていたのですが、stop,disnableや killall pythonを繰り返していたら
200
111
  起動しなくなりました。
@@ -215,4 +126,42 @@
215
126
  sudo python /home/pi/nas_all/test013.py
216
127
 
217
128
  exit 0
129
+ ```
130
+
131
+ ###追加
132
+ 追加確認事項です。
133
+ 起動時に失敗しているようです。
134
+ 理由がよくわかりません。
135
+
136
+ ```
137
+ pi@raspberrypi:~ $ sudo systemctl status test.service
138
+ ● test.service - Test
139
+ Loaded: loaded (/etc/systemd/system/test.service; enabled)
140
+ Active: failed (Result: start-limit) since 月 2017-09-18 08:19:26 JST; 39s ago
141
+ Process: 718 ExecStart=/usr/bin/python /home/pi/nas_all/test013.py (code=exited, status=1/FAILURE)
142
+ Main PID: 718 (code=exited, status=1/FAILURE)
143
+
144
+ 9月 18 08:19:25 raspberrypi systemd[1]: test.service: main process exited,...E
145
+ 9月 18 08:19:25 raspberrypi systemd[1]: Unit test.service entered failed s....
146
+ 9月 18 08:19:26 raspberrypi systemd[1]: test.service holdoff time over, sc....
147
+ 9月 18 08:19:26 raspberrypi systemd[1]: Stopping Test...
148
+ 9月 18 08:19:26 raspberrypi systemd[1]: Starting Test...
149
+ 9月 18 08:19:26 raspberrypi systemd[1]: test.service start request repeate....
150
+ 9月 18 08:19:26 raspberrypi systemd[1]: Failed to start Test.
151
+ 9月 18 08:19:26 raspberrypi systemd[1]: Unit test.service entered failed s....
152
+ Hint: Some lines were ellipsized, use -l to show in full.
153
+ ```
154
+ また、プロセスには表示されていませんでした。(文字数の関係で一部略)
155
+ ```
156
+ USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
157
+ pi 1226 0.0 0.1 2344 1444 ? S 08:19 0:00 gnome-pty-helpe
158
+ pi 1227 0.1 0.4 5960 4384 pts/0 Ss 08:19 0:00 /bin/bash
159
+ pi 1292 0.0 0.2 4220 2184 pts/0 R+ 08:22 0:00 ps aux
160
+ ```
161
+ 手動でスタートさせると確認できました。
162
+ ```
163
+ pi@raspberrypi:~ $ sudo systemctl start test.service
164
+ pi@raspberrypi:~ $ ps aux
165
+ USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
166
+ root 1384 12.4 0.9 21288 8916 ? Ssl 08:24 0:00 /usr/bin/python
218
167
  ```

2

rc\.local追加

2017/09/17 23:32

投稿

nagog
nagog

スコア16

title CHANGED
File without changes
body CHANGED
@@ -4,6 +4,7 @@
4
4
  ###発生している問題・エラーメッセージ
5
5
  OS起動時に自動実行されません。
6
6
 
7
+
7
8
  /etc/systemd/system/test.service
8
9
  上記ファイルを作成し、ファイルの内容は下記のとおりです。
9
10
 
@@ -195,7 +196,8 @@
195
196
  wpa_supplicant.service disabled
196
197
  x11-common.service masked
197
198
  ```
198
-
199
+ 最初は動いていたのですが、stop,disnableや killall pythonを繰り返していたら
200
+ 起動しなくなりました。
199
201
  この後どのようにしたら自動実行できますでしょうか?
200
202
  ご教示願います。
201
203
 
@@ -207,4 +209,10 @@
207
209
  pi 827 0.0 0.4 6092 4472 tty1 S+ 16:20 0:00 -bash
208
210
  pi 2042 0.6 0.4 5960 4388 pts/0 Ss 16:43 0:00 /bin/bash
209
211
  pi 2071 0.0 0.2 4220 2116 pts/0 R+ 16:43 0:00 ps u
212
+ ```
213
+ rc.localへの記述でも実行されませんでした。
214
+ ```
215
+ sudo python /home/pi/nas_all/test013.py
216
+
217
+ exit 0
210
218
  ```

1

プロセスの追記

2017/09/15 07:59

投稿

nagog
nagog

スコア16

title CHANGED
File without changes
body CHANGED
@@ -197,4 +197,14 @@
197
197
  ```
198
198
 
199
199
  この後どのようにしたら自動実行できますでしょうか?
200
- ご教示願います。
200
+ ご教示願います。
201
+
202
+ また、startで実行したときは実行できているのですが、プロセスで見れないのはなぜでしょうか?
203
+
204
+ ```
205
+ pi@raspberrypi:~ $ ps u
206
+ USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
207
+ pi 827 0.0 0.4 6092 4472 tty1 S+ 16:20 0:00 -bash
208
+ pi 2042 0.6 0.4 5960 4388 pts/0 Ss 16:43 0:00 /bin/bash
209
+ pi 2071 0.0 0.2 4220 2116 pts/0 R+ 16:43 0:00 ps u
210
+ ```