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

質問編集履歴

1

その他試した結果を追記

2021/07/19 05:17

投稿

kz04
kz04

スコア0

title CHANGED
File without changes
body CHANGED
@@ -30,4 +30,22 @@
30
30
 
31
31
  ### 試したこと
32
32
  ネット検索していたところ、DISPLAY=:0 とか DISPLAY=:0.0 または
33
- export DISPLAY=:0 という例もありましたので試してみましたが起動しませんでした。
33
+ export DISPLAY=:0 という例もありましたので試してみましたが起動しませんでした。
34
+
35
+ 50 13 * * * root DISPLAY=:0 /root/mywork/test.sh >> /tmp/result.log 2>&1
36
+ または
37
+ 53 13 * * * root DISPLAY=:0.0 /root/mywork/test.sh >> /tmp/result.log 2>&1
38
+ の結果 /var/log/cronには
39
+ CROND[224497]: (root) CMD (DISPLAY=:0.0 /root/mywork/test.sh >> /tmp/result.log 2>&1
40
+ result.logには
41
+ No protocol specified
42
+ 13:53:01: Error: Unable to initialize GTK+, is DISPLAY set properly?
43
+ となりました。
44
+
45
+ また
46
+ 57 13 * * * root export DISPLAY=:0 /root/mywork/test.sh >> /tmp/result.log 2>&1
47
+ にすると/var/log/cronには
48
+ CROND[224593]: (root) CMD (export DISPLAY=:0 /root/mywork/test.sh >> /tmp/result.log 2>&1)
49
+ result.logには
50
+ /bin/bash: 0 行: export: `/root/mywork/test.sh': 有効な識別子ではありません
51
+ となりました