コマンドラインですべての起動タスクを表示するにはどうすればよいですか?

コマンドラインですべての起動タスクを表示するにはどうすればよいですか?

私はRaspberry Piで特定のアプリケーションが実行される理由を見つけようとしましたが、起動時にアプリケーションを実行する方法は6つあります。これが私が見つけたものです。

  • /etc/rc.local
  • /home/pi/.bashrc
  • スクリプトを/etc/init.d/にコピーします。
  • システム制御
  • crontabによるスケジュール

コマンドラインから起動時に実行される(または実行するようにスケジュールされた)すべてのエントリを識別する方法はありますか?

ベストアンサー1

Debian はシステムベースのディストリビューションなので、すべての素晴らしいツールを入手できます。

したがって、システムを「起動完了!」状態にするために起動に必要なすべての項目のリストを提供しただけでなく、起動を完了するために使用できる他のツールのいくつかの例も提供しました。最後に始めている間に何が起こるかについてのより深い理解。

# Gives you a text-art tree of all the units that get started for
# your default boot target:

sudo systemctl list-dependencies default.target


# Takes the log from the last boot, and analyzes the critical chain, i.e.,
# what the things were the "next thing to happen" waited for the longest.
# For example, for a webserver to start, you might need to wait both for
# network to be up, as well as for the database server to be ready. The
# webserver might be the thing that the multiuser target was waiting for
# the longest, and not the synchronization of mails. 
# This critical chain will show what was "blocking" the system from
# continuing to boot for the most part. It is a useful tool if you want to 
# figure out how to optimize boot speed:

sudo systemd-analyze critical-chain


# Takes the log from the last boot, and list what took how long to
# start (and if it finishes, and isn't persistent, to finish), and
# outputs it as SVG data, which you can look at e.g. in your browser:

sudo systemd-analyze plot > boot-timings.svg
 

これには、「通常の」システム起動内のコンテンツのみが含まれます。タイマーがある場合(cron経由でも他の方法でも)、systemdはこれを知る方法はありません。しかし、常に同じです。 cronを起動時に実行されるツールとして誤って使用したことを忘れてしまう良い方法なので、Linuxディストリビューションではパッケージが実際に存在しないcronjobを設定することを許可しないという問題があります。とても厳しいです。 。 cronjobを使用しますが、起動時にランチャーを非表示にします。

おすすめ記事