私はすべての起動時に自分のCentOS 6を自動ログインするように設定しました。ブート時にインタラクティブスクリプトを実行し、デフォルトのtty添付のモニタ画面に表示
これを達成するために/etc/init/tty.confを変更しましたが、これはうまくいきます。 /etc/init/tty.conf
stop on runlevel [S016]
respawn
instance $TTY
#exec /sbin/mingetty $TTY
exec /sbin/mingetty --autologin root $TTY
usage 'tty TTY=/dev/ttyX - where X is console id'
の
コンテンツはその後、私は私の〜/ .bash_profileのスクリプトを実行するように設定されています。下の内容を参照してください。
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin
export PATH
echo "This is one time" >/tmp/one.txt
私は、ファイル/tmp/one.txtにテキストをecho'dしている上に、あなたが見ることができるように、ファイル内 期待テキストは一度だけ表示されます。しかし何らかの理由でこのスクリプトは3回実行されます。
/tmp/one.txtにI tail -f /tmp/one.txtが表示される場合。スクリプトが3回実行されたことを示しています。
tail -f /netboot/tmp/one.txt
This is one time
tail: /netboot/tmp/one.txt: file truncated
This is one time
tail: /netboot/tmp/one.txt: file truncated
This is one time
tail: /netboot/tmp/one.txt: file truncated
This is one time
は、私はそれを複数回実行することを防ぐために何ができるか、私はちょうどそれがすべてだ後、これを実行します。私は/etc/init/tty.confファイルから復活インスタンスの$ TTYを削除する必要がありましたがこの投稿