Create a command prompt loop Linux
Example:
[root@servername~ ]# while [ 1 ]
> do
> date;
> df –h |grep backup;
> sleep 600;
> done
This creates a loop that checks the disks mounted to the directories with the name “backup” and displays the date every ten minutes. This is useful to see the progress of a very large sync command on a ten minute basis. Obviously it can be changed for virtually any command.
Note: the “while [ 1 ]” basically means the while is always true, thus the “sleep 600” is required. Otherwise you would have an infinite loop just going crazy.
You can kill the output with ctrl-c
-Andy
[root@servername~ ]# while [ 1 ]
> do
> date;
> df –h |grep backup;
> sleep 600;
> done
This creates a loop that checks the disks mounted to the directories with the name “backup” and displays the date every ten minutes. This is useful to see the progress of a very large sync command on a ten minute basis. Obviously it can be changed for virtually any command.
Note: the “while [ 1 ]” basically means the while is always true, thus the “sleep 600” is required. Otherwise you would have an infinite loop just going crazy.
You can kill the output with ctrl-c
-Andy



0 Comments:
Post a Comment
Links to this post:
Create a Link
<< Home