システムが起動するたびに、CLIモードで自動的に合致端末を起動する方法は?

システムが起動するたびに、CLIモードで自動的に合致端末を起動する方法は?

アップデート2

現在の最良の方法は次のとおりです。

GUIモードのミラーリング。

問題:最後に開始されたemacsはターミナルセッションにバインドされて制限されます。

「さて、emacsは終わりました。今、bashコマンドを入力したい」と言ったらどうしますか? ? Ctrl + zと入力してemacsを一時停止できます。これにより、emacsはバックグラウンドに移動して再起動するまで停止します。しかし、ここで説明されているように、合致端末とemacsを起動すると、そうではありません!さらに、この不要な結果を防ぐために、Ctrl-x Ctrl-cを使用してemacsを終了して代替パスを選択すると、emacsが終了するだけでなく、合致端末セッションも終了します。望ましくない #2.解決策がありますが、少し昔ながらです。以下を行うよりも優れた方法が必要です。

Ctrl-alt-t (another mate-terminal-tab opens)
Ctrl-x Ctrl-c (end emacs and in the course of that weirdly also the 1st mate-terminal-tab)
emacs -nw (start emacs again, this time explicitely, manually causing it to be invoked as a "real, usual" session, also capable of responding to stop signals like typing in Ctrl+z)

最後の2つの問題を解決する方法を知っていますか?どんな助けでも大変感謝します。


更新 - コメントセクションに返信 - 後でデフォルトの投稿:

私はGUIへのユーザーとしての依存度を減らすためにCLI方式でこれを行いたいと思います。それでは、rc.localを使用する方向に進む方が良いと思いますか?まだ試していません。 crontabメソッドが機能しない場合に備えて、計画BとしてTODOリストに追加してください。これまではcrontabで動作すると仮定します。 crontabに私のユースケースの専用要素(「@reboot」など)があり、「cronjob日付の再起動」テストバルーンが機能する場合はどうしてですか? !しかし、システムユーザーはオンラインビデオ「Linux Crash Course - Cronを使用したジョブのスケジュール」をお勧めしますか?https://yewtu.be/watch?v=7cbP7fzn0D8

基本的な投稿:

わかりました!これは非常に簡単に見えますが、多くのことを試してみても正しく機能できません。

「ログインしたユーザーにこの行を追加するだけで終わりです!」と思うかもしれませんが、それほど @reboot mate-terminal 単純ではありません。

私は何が間違っていましたか?パズルを完成させる最後の部分はどこにありますか?私が試して見つけたもの:

最初の試み:GUI方式

Trisquel-start-button in the left desktop corner at the bottom >
System >
Preferences >
Personal >
Startup Applications >
Tab 'Startup Programs' >
'add' >
Edit Startup Program
Name: Mate Terminal
Command: mate-terminal --full-screen --hide-menubar
Comment: Terminal >
Save >
Ensuring the activation box next to the new entry is checked

あなたは知っていますか?効果があるほとんど。あまり良くない:

System starts >
Gui with log-in window appears >
logging-in >
Desktop appears, with mate-terminal being right open >
screen blinks 2, 3 times with white screen >
mate-terminal is not the active window,
it's at the top of the desktop, covers everything by full-screen-mode,
but typing doesn't go into the terminal,
so, first I need to select mate-terminal by Alt+TAB,
making it the active window,
and only then what I'm typing goes into mate-terminal as input
and appears on the screen as output

この次善策の結果、まず問題を深く掘り下げました!

2回目の試み:Crontab

以下は、crontabが期待どおりに機能するか、実際にどのようにスムーズに動作するかを示すために、いくつかの重要なことを明確にするための私の多くの試みをまとめたものです。

ログインしたユーザー

user@TechnoethicalX200T:~$ whoami
user

sudo メンバーシップ

user@TechnoethicalX200T:~$ cat /etc/group | grep sudo
sudo:x:27:user,automat

ペアリングされた端末の可用性

user@TechnoethicalX200T:~$ which mate-terminal
/usr/bin/mate-terminal

合致端末の実行 - 動作します

user@TechnoethicalX200T:~$ mate-terminal
(> new mate-terminal window popping up)

日付の可用性 - 比較のために、次のことを行います。

user@TechnoethicalX200T:~$ which date
/bin/date

ログインしたユーザー "user"のcrontab

# Edit this file to introduce tasks to be run by cron.
#
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
#
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use '*' in these fields (for 'any').#
# Notice that tasks will be started based on the cron's system
# daemon's notion of time and timezones.
#
# Output of the crontab jobs (including errors) is sent through
# email to the user the crontab file belongs to (unless redirected).
#
# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
#
# For more information see the manual pages of crontab(5) and cron(8)
#
# m h  dom mon dow   command

# @reboot date >> /tmp/test-file-date-collection
# Before un-commenting:
# - (File not existing)
# After un-commenting: Works!
# user@TechnoethicalX200T:~$ cat /tmp/test-file-date-collection
# Thu 23 Nov 08:54:30 CET 2023
# user@TechnoethicalX200T:~$ who -b
#          system boot  2023-11-23 08:54
# Conclusion:
# The logged-in user 'user' is capable of setting up a working reboot cronjob,
# with just specifying command name - not explicitely [full path]/[command name]

# Failed - syslog
# user@TechnoethicalX200T:~$ grep -C5 "mate-terminal" /var/log/syslog
# Nov 24 18:25:06 TechnoethicalX200T systemd[1]: Starting Permit User Sessions...
# Nov 24 18:25:06 TechnoethicalX200T cron[878]: (CRON) INFO (Running @reboot jobs)
# Nov 24 18:25:06 TechnoethicalX200T systemd[1]: Starting LSB: MD monitoring daemon...
# Nov 24 18:25:06 TechnoethicalX200T systemd[1]: Started D-Bus System Message Bus.
# Nov 24 18:25:06 TechnoethicalX200T dbus-daemon[888]: Unknown username "whoopsie" in message bus configuration file
# Nov 24 18:25:06 TechnoethicalX200T CRON[891]: (user) CMD (mate-terminal)
# Nov 24 18:25:06 TechnoethicalX200T dbus[888]: [system] AppArmor D-Bus mediation is enabled
# Nov 24 18:25:06 TechnoethicalX200T avahi-daemon[876]: Successfully called chroot().
# Nov 24 18:25:06 TechnoethicalX200T avahi-daemon[876]: Successfully dropped remaining capabilities.
# Nov 24 18:25:06 TechnoethicalX200T systemd[1]: Started Avahi mDNS/DNS-SD Stack.
# Nov 24 18:25:06 TechnoethicalX200T avahi-daemon[876]: No service file found in /etc/avahi/services.
@reboot mate-terminal
(<<< newline character behind last line - both, of the whole crontab and of each active cronjob in it
That detail turned out to be important for crontab to work properly, and not on all systems that automatically gets added,
I had to input it manually)

簡単に言えば、これはテストバルーン「cronjob date restart」が機能するという事実からも推論できます。はい、cron.serviceは私のシステムで有効になっています(いつものように現在実行中です)。

また、システムユーザーを作成してsudo権限を付与した後、cronjobを実行するようにしました。

automat:x:1001:1001::/home/automat:/usr/sbin/nologin

静脈へ。

user@TechnoethicalX200T:~$ grep -C5 "mate-terminal" /var/log/syslog
Nov 24 18:25:06 TechnoethicalX200T systemd[1]: Starting Permit User Sessions...
Nov 24 18:25:06 TechnoethicalX200T cron[878]: (CRON) INFO (Running @reboot jobs)
Nov 24 18:25:06 TechnoethicalX200T systemd[1]: Starting LSB: MD monitoring daemon...
Nov 24 18:25:06 TechnoethicalX200T systemd[1]: Started D-Bus System Message Bus.
Nov 24 18:25:06 TechnoethicalX200T dbus-daemon[888]: Unknown username "whoopsie" in message bus configuration file
Nov 24 18:25:06 TechnoethicalX200T CRON[891]: (user) CMD (mate-terminal)
Nov 24 18:25:06 TechnoethicalX200T dbus[888]: [system] AppArmor D-Bus mediation is enabled
Nov 24 18:25:06 TechnoethicalX200T avahi-daemon[876]: Successfully called chroot().
Nov 24 18:25:06 TechnoethicalX200T avahi-daemon[876]: Successfully dropped remaining capabilities.
Nov 24 18:25:06 TechnoethicalX200T systemd[1]: Started Avahi mDNS/DNS-SD Stack.
Nov 24 18:25:06 TechnoethicalX200T avahi-daemon[876]: No service file found in /etc/avahi/services.
--
Nov 24 18:38:47 TechnoethicalX200T systemd[1]: Started inputattach for Wacom ISDv4-compatible serial devices.
Nov 24 18:38:47 TechnoethicalX200T systemd[1]: Starting Avahi mDNS/DNS-SD Stack...
Nov 24 18:38:47 TechnoethicalX200T systemd[1]: Starting LSB: daemon to balance interrupts for SMP systems...
Nov 24 18:38:47 TechnoethicalX200T avahi-daemon[899]: Found user 'avahi' (UID 109) and group 'avahi' (GID 118).
Nov 24 18:38:47 TechnoethicalX200T systemd[1]: Starting Login Service...
Nov 24 18:38:47 TechnoethicalX200T CRON[912]: (automat) CMD (mate-terminal)
Nov 24 18:38:47 TechnoethicalX200T systemd[1]: Starting Console System Startup Logging...
Nov 24 18:38:47 TechnoethicalX200T avahi-daemon[899]: Successfully dropped root privileges.
Nov 24 18:38:47 TechnoethicalX200T avahi-daemon[899]: avahi-daemon 0.6.32-rc starting up.
Nov 24 18:38:47 TechnoethicalX200T avahi-daemon[899]: Successfully called chroot().
Nov 24 18:38:47 TechnoethicalX200T systemd[1]: Starting LSB: Start the GNUstep distributed object mapper...

それでは、問題は何ですか?真剣に、なぜ動作しないのですか?再起動後にデスクトップのみが表示され、同伴端末ウィンドウが表示されないのはなぜですか?私にとっては理解できません。

ベストアンサー1

おすすめ記事