0
スリープする直前に実行されるスクリプトを作成しようとしています。誰かが私がここで間違っていることを教えてもらえますか?このスクリプトは、ターミナルでコマンドを実行すると完全に実行されます。ログからスリープする前にスクリプトが実行されていない
[email protected] /etc/pm/sleep.d $ ls
total 1MB
drwxr-xr-x 2 root root 1MB May 30 15:21 .
drwxr-xr-x 5 root root 1MB Nov 28 2015 ..
-rwxr-xr-x 1 root root 1MB Jun 26 2015 10_grub-common
-rwxr-xr-x 1 root root 1MB Dec 6 2013 10_unattended-upgrades-hibernate
-rwxr-xr-x 1 root root 1MB May 22 2012 novatel_3g_suspend
-rwxr-xr-x 1 root root 1MB May 30 15:20 revert_kb_on_sleep
[email protected] /etc/pm/sleep.d $ cat revert_kb_on_sleep
sh -c "/home/king/Desktop/Scripts/rotate_desktop normal; /home/king/Desktop/Scripts/misc/my_keyboard on"
出力:
$ cat /var/log/pm-suspend.log
Running hook /etc/pm/sleep.d/revert_kb_on_sleep suspend suspend:
Can't open display
Can't open display
xrandr: --rotate requires an argument
Try 'xrandr --help' for more information.
No protocol specified
Unable to connect to X server
/etc/pm/sleep.d/revert_kb_on_sleep suspend suspend: success.
Mon May 30 15:23:39 EDT 2016: performing suspend
Mon May 30 15:27:59 EDT 2016: Awake.
Mon May 30 15:27:59 EDT 2016: Running hooks for resume
Running hook /etc/pm/sleep.d/revert_kb_on_sleep resume suspend:
Can't open display
Can't open display
xrandr: --rotate requires an argument
Try 'xrandr --help' for more information.
No protocol specified
Unable to connect to X server
/etc/pm/sleep.d/revert_kb_on_sleep resume suspend: Returned exit code 1.
デーモンから実行されたときに、X-Windowsのコンテキスト/ DISPLAY環境変数が設定されていないようです - xrandrに '-d:0.0'(表示オプション)のようなものを追加して、許可の問題に遭遇しません。私はあなたがしようとしていることがsleep.dに属していないと感じている。dirだが、あなたのウィンドウマネージャ/デスクトップの設定には、いくつかのアクションを指定できる場所があります...? –
私は何かを見つけたら、Linux mintにかなり新しい、私はいくつかの研究とコメントを返すだろう。先端に感謝します。将来これを読んでいる人には、 '-d:0.0'は権限の問題を引き起こします。私は最初にスクリプトを動作させるときにこれを発見しました。 – Rilcon42
これを行う別の方法を見つける運がいいえ...誰にでもアイデアはありますか? – Rilcon42