Сценарии сетевых событий запускаются от имени пользователя root, но ваша среда рабочего стола, вероятно, (надеюсь )нет.
В целом это кажется проблемным подходом. Не хватает нескольких вещей:
~/.Xauthority
иman xauth
). HOME
, XDG_RUNTIME_DIR
и т. д.)Я бы предложил попробовать другой подход, например. наличие сетевого сценария, сообщающего состояние сети (через канал / временный файл / DBus )чему-то, что уже запущено в пользовательском сеансе (, запущенном, например. из ~/.xinitrc
), который затем запускает приложения с графическим интерфейсом по мере необходимости.
There is no way to split a single command line onto multiple lines, like the shell's trailing "\"
Вы найдете указанное выше утверждение в следующем абзаце, если сделаете man 5 crontab
. Обратите внимание, что ниже приведена версия Ubuntu 20.04LTS.
The ``sixth'' field (the rest of the line) specifies the command to be run. The entire command portion of the line, up to a newline or % character, will be executed by /bin/sh or by the shell speci‐ fied in the SHELL variable of the crontab file. Percent-signs (%) in the command, unless escaped with backslash (\), will be changed into newline characters, and all data after the first % will be sent to the command as standard input. There is no way to split a single command line onto multiple lines, like the shell's trailing "\"
Изhttps://man.openbsd.org/crontab.5
В нем говорится, что остальная часть строки является полем команды, но не говорится, как команда занимает несколько строк. Вы не должны предполагать, что crontab имеет тот же синтаксис, что и сценарий оболочки.
The command field (the rest of the line) is the command to be run. The entire command portion of the line, up to a newline or % character, will be executed by /bin/sh or by the shell specified in the SHELL variable of the crontab. Percent signs (‘%’) in the command, unless escaped with a backslash (‘\’), will be changed into newline characters, and all data after the first ‘%’ will be sent to the command as standard input.