Re: shell script

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



Mad Unix wrote:
> I have to run multiple  command about 20x on linux each one got his
> own output, I want to bind all the out puts of them in one file then
> read this file and mail it to user account
>
> sample
>
> [root@imail pons]# /home/pons/tsmmonitor stgpool SDC-STAFF
> stgpool - utilization of storage pool SDC-STAFF 62%, OK
> [root@imail pons]# /home/pons/tsmmonitor stgpool ISO-BACKUP-POOL
> stgpool - utilization of storage pool ISO-BACKUP-POOL 41%, OK
> [root@imail pons]# /home/pons/tsmmonitor stgpool ORACLE-DUMP-POOL
> stgpool - utilization of storage pool ORACLE-DUMP-POOL 62%, OK
> [root@imail pons]# /home/pons/tsmmonitor stgpool ORACLE-DUMP-POOL
> stgpool - utilization of storage pool ORACLE-DUMP-POOL 62%, OK
>
> I want all these out puts be bind it in one file
>
> myfile:
>
> stgpool - utilization of storage pool SDC-STAFF 62%, OK
> stgpool - utilization of storage pool ISO-BACKUP-POOL 41%, OK
> stgpool - utilization of storage pool ORACLE-DUMP-POOL 62%, OK
> stgpool - utilization of storage pool ORACLE-DUMP-POOL 62%, OK
>
> then to read this file and send it to email address
>
> Thanks
> _______________________________________________
> CentOS mailing list
> CentOS@xxxxxxxxxx
> http://lists.centos.org/mailman/listinfo/centos
>
>   
Hi,

Do this by re-directing the output from your commands into a file like this:

[root@imail pons]# /home/pons/tsmmonitor stgpool SDC-STAFF > outfile

[root@imail pons]# /home/pons/tsmmonitor stgpool ISO-BACKUP-POOL >> outfile

[root@imail pons]# /home/pons/tsmmonitor stgpool ORACLE-DUMP-POOL >>outfile

[root@imail pons]# /home/pons/tsmmonitor stgpool ORACLE-DUMP-POOL >>outfile

Note that the single ">" in the first line will create a new "outfile" 
that is it will create the file if it does not exist or over-write it if 
it does exist.

The double ">>" in the following commands will append the output of 
those commands to the already existing "outfile".

ChrisG




_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos

[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux