目次~
#contents
*概要 [#l0e0c74a]
同じコマンドを連続で自動実行する方法。~


*方法 [#za5d4e7c]
**yesコマンドを使用する [#x1a85f84]
yesコマンドに渡した文字列をshellにパイプで渡すことで、コマンドの連続実行を行う。~
yesコマンドに渡した文字列をshellにパイプで渡すことで、コマンドを実行する。~

-書式
 yes '[実行するコマンド]:sleep [間隔(秒)]' | sh

-サンプル
 yes 'cat /proc/drbd ; sleep 1'| sh


**whileを使用する [#s84c9542]
whileを使用して、ループするシェルスクリプトを実行する。

-書式
 while true; do [実行するコマンド] ; sleep [間隔(秒)] ; done 

-サンプル
 while true; do cat /proc/drbd ; sleep 1 ; done

トップ   編集 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS