質問編集履歴

2

質問内容を簡潔にしました。

2019/11/27 03:49

投稿

raspypy
raspypy

スコア247

test CHANGED
File without changes
test CHANGED
@@ -26,32 +26,6 @@
26
26
 
27
27
 
28
28
 
29
- ```text
30
-
31
- [Unit]
32
-
33
- Description=Manufacturing_Recorder
34
-
35
- Wants=network.target
36
-
37
-
38
-
39
- [Service]
40
-
41
- ExecStart=/home/pi/dev/test.sh
42
-
43
- Restart=on-failure
44
-
45
- RestartSec=10s
46
-
47
-
48
-
49
- [Install]
50
-
51
- WantedBy=multi-user.target
52
-
53
- ```
54
-
55
29
 
56
30
 
57
31
  ##シェルスクリプト
@@ -73,149 +47,3 @@
73
47
  /home/pi/dev/gdrive sync upload /home/pi/data hogehoge
74
48
 
75
49
  ```
76
-
77
-
78
-
79
- ##繰り返し実行するプログラム
80
-
81
- **内容**
82
-
83
- データ更新を判定するプログラム。
84
-
85
- データが更新されるまで、LEDを点滅し続けるプログラム。
86
-
87
- データが更新されると、プログラムは終了する。
88
-
89
- **終了したら、プログラムを再び実行したい。**
90
-
91
- ```Python
92
-
93
- import csv
94
-
95
-
96
-
97
- import re
98
-
99
- import requests
100
-
101
- import os
102
-
103
-
104
-
105
- import pandas as pd
106
-
107
-
108
-
109
- import RPi.GPIO as GPIO
110
-
111
- from time import sleep
112
-
113
-
114
-
115
- def setup_led():
116
-
117
- GPIO.setmode(GPIO.BCM)
118
-
119
- GPIO.setup(19, GPIO.OUT)
120
-
121
- GPIO.output(19, GPIO.LOW)
122
-
123
- def read_temp():
124
-
125
- #global df_c
126
-
127
- df_c = pd.read_csv('/home/pi/count.csv', names=['year', 'month', 'day', 'hour', 'minute', 'temperature'])
128
-
129
- #カウント
130
-
131
- global y_bool
132
-
133
- y_bool = df_c['year'] == 0
134
-
135
- def LED():
136
-
137
- read_temp()
138
-
139
- y_sum = y_bool.sum()
140
-
141
- prev_y_sum = y_bool.sum()
142
-
143
- while True:
144
-
145
- while y_sum == prev_y_sum:
146
-
147
- GPIO.output(19, GPIO.HIGH)
148
-
149
- sleep(1.0)
150
-
151
- GPIO.output(19, GPIO.LOW)
152
-
153
- sleep(1.0)
154
-
155
- read_temp()
156
-
157
- y_sum = y_bool.sum()
158
-
159
- print ('prev=' + str(prev_y_sum))
160
-
161
- print ('current=' + str(y_sum))
162
-
163
- else:
164
-
165
- break
166
-
167
- if __name__ == '__main__':
168
-
169
- try:
170
-
171
- setup_led()
172
-
173
- #read_temp()
174
-
175
- LED()
176
-
177
- except KeyboardInterrupt:
178
-
179
- pass
180
-
181
- GPIO.cleanup()
182
-
183
- ```
184
-
185
-
186
-
187
- ##システムログ
188
-
189
- ```text
190
-
191
- Nov 27 09:28:28 raspberrypi systemd[1]: Started test.
192
-
193
- Nov 27 09:28:28 raspberrypi systemd[1]: Reloading.
194
-
195
- Nov 27 09:28:29 raspberrypi test.sh[25270]: Traceback (most recent call last):
196
-
197
- Nov 27 09:28:29 raspberrypi test.sh[25270]: File "/home/pi/dev/./test.py", line 14, in <module>
198
-
199
- Nov 27 09:28:29 raspberrypi test.sh[25270]: import pandas as pd
200
-
201
- Nov 27 09:28:29 raspberrypi test.sh[25270]: ImportError: No module named pandas
202
-
203
- Nov 27 09:28:29 raspberrypi test.sh[25270]: Authentication needed
204
-
205
- Nov 27 09:28:29 raspberrypi test.sh[25270]: Go to the following url in your browser:
206
-
207
- Nov 27 09:28:29 raspberrypi test.sh[25270]: https://accounts.google.com/o/oauth2/auth?access_type=offline&client_id=367116221053-7n0vf5akeru7on6o2fjinrecpdoe99eg.apps.googleusercontent.com&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&response_type=code&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive&state=state
208
-
209
- Nov 27 09:28:29 raspberrypi test.sh[25270]: Enter verification code: Failed reading code: EOFFailed getting oauth client: Failed to exchange auth code for token: Post https://accounts.google.com/o/oauth2/token: dial tcp 172.217.31.141:443: getsockopt: no route to host
210
-
211
- Nov 27 09:28:29 raspberrypi systemd[1]: test.service: Main process exited, code=exited, status=1/FAILURE
212
-
213
- Nov 27 09:28:29 raspberrypi systemd[1]: test.service: Failed with result 'exit-code'.
214
-
215
- Nov 27 09:28:29 raspberrypi systemd[1]: test.service: Service RestartSec=100ms expired, scheduling restart.
216
-
217
- Nov 27 09:28:29 raspberrypi systemd[1]: test.service: Scheduled restart job, restart counter is at 5336.
218
-
219
- Nov 27 09:28:29 raspberrypi systemd[1]: Stopped test.
220
-
221
- ```

1

エラー発生時のシステムログを追加しました。

2019/11/27 03:49

投稿

raspypy
raspypy

スコア247

test CHANGED
File without changes
test CHANGED
@@ -181,3 +181,41 @@
181
181
  GPIO.cleanup()
182
182
 
183
183
  ```
184
+
185
+
186
+
187
+ ##システムログ
188
+
189
+ ```text
190
+
191
+ Nov 27 09:28:28 raspberrypi systemd[1]: Started test.
192
+
193
+ Nov 27 09:28:28 raspberrypi systemd[1]: Reloading.
194
+
195
+ Nov 27 09:28:29 raspberrypi test.sh[25270]: Traceback (most recent call last):
196
+
197
+ Nov 27 09:28:29 raspberrypi test.sh[25270]: File "/home/pi/dev/./test.py", line 14, in <module>
198
+
199
+ Nov 27 09:28:29 raspberrypi test.sh[25270]: import pandas as pd
200
+
201
+ Nov 27 09:28:29 raspberrypi test.sh[25270]: ImportError: No module named pandas
202
+
203
+ Nov 27 09:28:29 raspberrypi test.sh[25270]: Authentication needed
204
+
205
+ Nov 27 09:28:29 raspberrypi test.sh[25270]: Go to the following url in your browser:
206
+
207
+ Nov 27 09:28:29 raspberrypi test.sh[25270]: https://accounts.google.com/o/oauth2/auth?access_type=offline&client_id=367116221053-7n0vf5akeru7on6o2fjinrecpdoe99eg.apps.googleusercontent.com&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&response_type=code&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive&state=state
208
+
209
+ Nov 27 09:28:29 raspberrypi test.sh[25270]: Enter verification code: Failed reading code: EOFFailed getting oauth client: Failed to exchange auth code for token: Post https://accounts.google.com/o/oauth2/token: dial tcp 172.217.31.141:443: getsockopt: no route to host
210
+
211
+ Nov 27 09:28:29 raspberrypi systemd[1]: test.service: Main process exited, code=exited, status=1/FAILURE
212
+
213
+ Nov 27 09:28:29 raspberrypi systemd[1]: test.service: Failed with result 'exit-code'.
214
+
215
+ Nov 27 09:28:29 raspberrypi systemd[1]: test.service: Service RestartSec=100ms expired, scheduling restart.
216
+
217
+ Nov 27 09:28:29 raspberrypi systemd[1]: test.service: Scheduled restart job, restart counter is at 5336.
218
+
219
+ Nov 27 09:28:29 raspberrypi systemd[1]: Stopped test.
220
+
221
+ ```