質問編集履歴

10

2019/04/27 13:55

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  pythonプログラムをcrontabを用いて毎日定時(具体的には、webスクレイプしてexcel出力刷るプログラム)に実行 エラーを起こしたら、MAILTOなりなんなりつかってlog返す
4
4
 
5
- 試験として、pythonプログラムが定時に起動しているか調べるため、print()などを含めたテスト用プログラムを実行し、結果とエラーをmail.logに記述するよう試験したい(要は 上記のプログラムが実行され、エラーが帰ってくるプログラムを作るしけん)
5
+ 試験として、pythonプログラムが定時に起動しているか調べるため、print()などを含めたテスト用プログラムを実行し、結果とエラーをmail.logに記述するよう試験したい(要は 上記のプログラムが実行され、エラーが帰ってくるプログラムを作るしけんです
6
6
 
7
7
 
8
8
 

9

2019/04/27 13:55

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  pythonプログラムをcrontabを用いて毎日定時(具体的には、webスクレイプしてexcel出力刷るプログラム)に実行 エラーを起こしたら、MAILTOなりなんなりつかってlog返す
4
4
 
5
- 試験として、pythonプログラムが起動しているか調べるため、print()などを含めたテスト用プログラムを実行し、結果とエラーをmail.logに記述するよう試験したい(要は 上記のプログラムが実行され、エラーが帰ってくるプログラムを作るしけん)
5
+ 試験として、pythonプログラムが定時に起動しているか調べるため、print()などを含めたテスト用プログラムを実行し、結果とエラーをmail.logに記述するよう試験したい(要は 上記のプログラムが実行され、エラーが帰ってくるプログラムを作るしけん)
6
6
 
7
7
 
8
8
 

8

2019/04/27 13:27

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -1,3 +1,11 @@
1
+ 行いたいこと
2
+
3
+ pythonプログラムをcrontabを用いて毎日定時(具体的には、webスクレイプしてexcel出力刷るプログラム)に実行 エラーを起こしたら、MAILTOなりなんなりつかってlog返す
4
+
5
+ 試験として、pythonプログラムが起動しているか調べるため、print()などを含めたテスト用プログラムを実行し、結果とエラーをmail.logに記述するよう試験したい(要は 上記のプログラムが実行され、エラーが帰ってくるプログラムを作るしけん)
6
+
7
+
8
+
1
9
  crontab -e
2
10
 
3
11
  ```python

7

yo

2019/04/27 13:21

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -2,7 +2,9 @@
2
2
 
3
3
  ```python
4
4
 
5
- 4 22 * * * /usr/bin/python3 /mnt/c/Users/a.sakata/AppData/Local/Packages/CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc/LocalState/rootfs/home/attyan22/python_lesson/crontest_2.py > /var/log/mail.log 2>&1```
5
+ 4 22 * * * /usr/bin/python3 /mnt/c/Users/a.sakata/AppData/Local/Packages/CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc/LocalState/rootfs/home/attyan22/python_lesson/crontest_2.py > /var/log/mail.log 2>&1
6
+
7
+ ```
6
8
 
7
9
  Maildir
8
10
 

6

yo

2019/04/27 13:10

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -1,3 +1,9 @@
1
+ crontab -e
2
+
3
+ ```python
4
+
5
+ 4 22 * * * /usr/bin/python3 /mnt/c/Users/a.sakata/AppData/Local/Packages/CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc/LocalState/rootfs/home/attyan22/python_lesson/crontest_2.py > /var/log/mail.log 2>&1```
6
+
1
7
  Maildir
2
8
 
3
9
  ```python
@@ -8,21 +14,23 @@
8
14
 
9
15
  Delivered-To: attyan22@LAPTOP-SGBTV53C.com
10
16
 
11
- Received: by mx.LAPTOP-SGBTV53C.com (Postfix, from userid 1000)
17
+ Received: by mail.LAPTOP-SGBTV53C.com (Postfix, from userid 1000)
12
18
 
13
- id 40DBEF000000060540; Fri, 26 Apr 2019 20:24:01 +0900 (DST)
19
+ id BFF2F330000000611FA; Sat, 27 Apr 2019 22:04:01 +0900 (DST)
14
20
 
15
21
  From: root@LAPTOP-SGBTV53C.com (Cron Daemon)
16
22
 
17
23
  To: attyan22@LAPTOP-SGBTV53C.com
18
24
 
19
- Subject: Cron <attyan22@LAPTOP-SGBTV53C> /mnt/c/Users/a.sakata/AppData/Local/Packages/CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc/LocalState/rootfs/home/attyan22/python_lesson/cron.sh > /var/log/mail.log 2>&1
25
+ Subject: Cron <attyan22@LAPTOP-SGBTV53C> /usr/bin/python3 /mnt/c/Users/a.sakata/AppData/Local/Packages/CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc/LocalState/rootfs/home/attyan22/python_lesson/crontest_2.py > /var/log/mail.log 2>&1
20
26
 
21
27
  MIME-Version: 1.0
22
28
 
23
29
  Content-Type: text/plain; charset=UTF-8
24
30
 
25
31
  Content-Transfer-Encoding: 8bit
32
+
33
+ X-Cron-Env: <MAILTO=attyan22>
26
34
 
27
35
  X-Cron-Env: <SHELL=/bin/sh>
28
36
 
@@ -32,9 +40,9 @@
32
40
 
33
41
  X-Cron-Env: <LOGNAME=attyan22>
34
42
 
35
- Message-Id: <20190426112401.40DBEF000000060540@mx.LAPTOP-SGBTV53C.com>
43
+ Message-Id: <20190427130401.BFF2F330000000611FA@mail.LAPTOP-SGBTV53C.com>
36
44
 
37
- Date: Fri, 26 Apr 2019 20:24:01 +0900 (DST)
45
+ Date: Sat, 27 Apr 2019 22:04:01 +0900 (DST)
38
46
 
39
47
 
40
48
 

5

2019/04/27 13:09

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -76,7 +76,7 @@
76
76
 
77
77
  ```
78
78
 
79
- cronでpythonのプログラムを自動化
79
+ cronでpythonのプログラムを自動化をやりたい
80
80
 
81
81
  mail.log には sent to Maildir
82
82
 

4

yo

2019/04/27 12:54

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -44,6 +44,14 @@
44
44
 
45
45
  /var/spool/cron/crontabs/crontab/attyan22 を編集
46
46
 
47
+ ```python
48
+
49
+ attyan22@LAPTOP-SGBTV53C:~$ sudo ls -l /var/spool/cron/crontabs/attyan22
50
+
51
+ -rw------- 1 attyan22 crontab 1791 Apr 27 16:22 /var/spool/cron/crontabs/attyan22
52
+
53
+ ```
54
+
47
55
  実行権限
48
56
 
49
57
  ```python

3

yo

2019/04/27 12:53

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -42,6 +42,32 @@
42
42
 
43
43
  ```
44
44
 
45
+ /var/spool/cron/crontabs/crontab/attyan22 を編集
46
+
47
+ 実行権限
48
+
49
+ ```python
50
+
51
+ attyan22@LAPTOP-SGBTV53C:~$ sudo ls -l /home/attyan22/python_lesson/crontest_2.py
52
+
53
+ [sudo] password for attyan22:
54
+
55
+ -rwx--x--x 1 attyan22 attyan22 0 Apr 26 20:24 /home/attyan22/python_lesson/crontest_2.py
56
+
57
+ attyan22@LAPTOP-SGBTV53C:~$ sudo ls -l /home/attyan22/python_lesson/crontest_2.py
58
+
59
+ -rwx--x--x 1 attyan22 attyan22 0 Apr 26 20:24 /home/attyan22/python_lesson/crontest_2.py
60
+
61
+ attyan22@LAPTOP-SGBTV53C:~$ sudo ls -l /usr/bin/python3
62
+
63
+ lrwxrwxrwx 1 attyan22 attyan22 9 Oct 25 2018 /usr/bin/python3 -> python3.6
64
+
65
+ attyan22@LAPTOP-SGBTV53C:~$ sudo ls -l /usr/bin/python3.6
66
+
67
+ -rwxr-xr-x 2 root root 4522328 Oct 22 2018 /usr/bin/python3.6
68
+
69
+ ```
70
+
45
71
  cronでpythonのプログラムを自動化
46
72
 
47
73
  mail.log には sent to Maildir

2

2019/04/27 12:48

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -46,4 +46,4 @@
46
46
 
47
47
  mail.log には sent to Maildir
48
48
 
49
- pythonプログラム実行されてますか
49
+ pythonプログラム実行されてるか分かりせん

1

2019/04/27 12:41

投稿

退会済みユーザー
test CHANGED
@@ -1 +1 @@
1
- どなたか教えて下さい crontab
1
+ 教えて下さい crontab
test CHANGED
File without changes