質問編集履歴
1
プログラムの概要を追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -67,3 +67,35 @@
|
|
67
67
|
【実行環境】
|
68
68
|
・サーバー:さくらVPS
|
69
69
|
・OS:Ubuntu 20.04 amd64(64bit)
|
70
|
+
|
71
|
+
|
72
|
+
## 【追記】
|
73
|
+
実行しているプログラムの概要は以下の通りです。
|
74
|
+
|
75
|
+
```
|
76
|
+
chrome_service = service.Service(executable_path=ChromeDriverManager().install())
|
77
|
+
driver = webdriver.Chrome(service=chrome_service, options=options)
|
78
|
+
|
79
|
+
def main():
|
80
|
+
# スクレイピング処理
|
81
|
+
# Webサイトから情報を取得し、LINEで通知しています。
|
82
|
+
# ファイルのダウンロードなどは行なっていません。
|
83
|
+
|
84
|
+
if __name__ == "__main__":
|
85
|
+
lockfilePath = 'lockfile.lock'
|
86
|
+
with open(lockfilePath , "w") as lockFile:
|
87
|
+
try:
|
88
|
+
fcntl.flock(lockFile, fcntl.LOCK_EX | fcntl.LOCK_NB)
|
89
|
+
|
90
|
+
main()
|
91
|
+
driver.delete_all_cookies()
|
92
|
+
driver.close()
|
93
|
+
driver.quit()
|
94
|
+
|
95
|
+
except IOError:
|
96
|
+
print('process already exists')
|
97
|
+
|
98
|
+
```
|
99
|
+
|
100
|
+
|
101
|
+
|