Sponsored Content
Top Forums Shell Programming and Scripting Inquiry on Grabbing info from file. Post 302519338 by NelsonC on Tuesday 3rd of May 2011 05:43:00 PM
Old 05-03-2011
Inquiry on Grabbing info from file.

Here is another script I am trying to customize currently,

this script is used to send me disk space information, but at the moment I have to enter all the servers in manually SERVER= "xxx bbb ccc" ect..

how can I script it so that the servers are called off a txt file versus me entering all of them ? my intention is to separate them PROD, QA ect.. and call those txt files and environments when needed.

Like a plug and play.
Code:
#!/bin/bash
Date="'date +%m/%d/%y %H:%M:%S'"

SERVERS="xxx bbb ccc" 
USR="me"

# Email
SUBJECT="Disk Free Verification for Hosts"
EMAIL="xxx@ex"
EMAILMESSAGE="/u/home/xxx/AccountV.txt"

# create new file
>$EMAILMESSAGE

# connect each host and pull up user listing
for host in $SERVERS
do
echo "--------------------------------" >>$EMAILMESSAGE
echo "* HOST: $host " >>$EMAILMESSAGE
echo "--------------------------------" >>$EMAILMESSAGE
ssh $USR@$host df -h | sed '/platform/d' >> $EMAILMESSAGE
done

# send an email using /bin/mail
#/bin/mail -s "$SUBJECT" "$EMAIL" < $EMAILMESSAGE
mailx -s "$SUBJECT" "$EMAIL" < $EMAILMESSAGE


Last edited by Scott; 05-03-2011 at 07:27 PM.. Reason: Code tags
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

script grabbing cvs file .....

how do I write a script to checkout a file in cvs and cat the file into a file in my home directory Commands are cd /home/smr/sandbox cvsroot choose option 1 cvs co filename cat filename > /home/smr/newfilename Thank you! (4 Replies)
Discussion started by: llsmr777
4 Replies

2. Shell Programming and Scripting

Sed grabbing the last line of a file

I can grab the first line w/ sed how do you grab the last line of a file? (2 Replies)
Discussion started by: xgringo
2 Replies

3. UNIX for Dummies Questions & Answers

Grabbing a value from an output file

I am executing a stored proc and sending the results in a log file. I then want to grab one result from the output parameters (bolded below, 2) so that I can store it in a variable which will then be called in another script. There are more details that get printed in the beginning of the log file,... (3 Replies)
Discussion started by: hern14
3 Replies

4. Shell Programming and Scripting

Grabbing info from Telnet

I have a process that is running locally on the machine. When you telnet to the process: telnet IP port, it automatically returns a string which shows the status of that process. Something like this: # telnet IP Port Trying 127.0.0.1... Connected to localhost (127.0.0.1). Escape... (3 Replies)
Discussion started by: skaptakalian
3 Replies

5. Shell Programming and Scripting

grabbing filename from text file....should be easy!

Quick question...I'm trying to grab the .tif file name from this output from our fax server. What is the best way i can do this in a bash script? I have been looking at regular expressions with bash or using awk but having some trouble. thanks! The only output i want is... (5 Replies)
Discussion started by: kuliksco
5 Replies

6. Shell Programming and Scripting

Kornshell grabbing value from file

I have a script right now that I run a command which outputs just one word to a file. Well I need to grab that value and use it in another line of code so... touch oraclesid.txt echo $ORACLE_SID > oraclesid.txt #grab that value sqlplus v500/v500@<value> how do I grab that value from the... (6 Replies)
Discussion started by: Blogger11
6 Replies

7. Cybersecurity

Inquiry of .awo hidden dir with bin file inside .eeesync extension

Hi, Me i ask if someone knows about this hidden directory or it me knows where this dir associated with or in a program. I had and notices this .awo dir with bin files inside title 6770669_info.eeesync files in my directory. I wonder if this is associated with my backup program or any program... (0 Replies)
Discussion started by: jao_madn
0 Replies

8. Shell Programming and Scripting

Grabbing the newest file, cleaner method?

Greetings, I'm doing a process whereby I need to search for all filenames containing a given bit of text and grab the newest file from what may be 20 results. In a script I'm writing, i've got a monster line to do the sort as follows: find /opt/work/reports/input -name "*$searchtarget*" |... (4 Replies)
Discussion started by: Karunamon
4 Replies

9. Shell Programming and Scripting

Grabbing a chunk of text from a file

Hi, I have a Report.txt file. Say the contents of this file are : 1 2 3 4 5 7 df v g gf e r dfkf lsdk dslsdklsdk Report Start: xxxxxxdad asdffsdfsdfsdfasfasdffasdf sadfasdfsadffsfsdf Report End. sdfasdfasdf sdfasfdasdfasdfasdfasdf sadfasdfsdf I need to grab from Report Start... (3 Replies)
Discussion started by: mrskittles99
3 Replies

10. Shell Programming and Scripting

Grabbing value from file and run command in ``

Hi ALL, How can I make a script take data from a file and execute the commands within `` in the file n put that that in a variable? for i in `cat file` do file=`grep -i key file` cp ${file} test done file /tmp/`date +y`log /tmp/unix`date +y`log (1 Reply)
Discussion started by: 3junior
1 Replies
asadmin-list-virtual-servers(1AS)				   User Commands				 asadmin-list-virtual-servers(1AS)

NAME
asadmin-list-virtual-servers, list-virtual-servers - gets the virtual servers SYNOPSIS
list-virtual-servers --user admin_user [--password admin_password] [--host localhost] [--port 4848] [--secure|-s] [--passwordfile filename] [--terse=false] [--echo=false] [--interactive=true] Gets all the virtual server elements. This command is supported in remote mode only. OPTIONS
--user authorized domain application server administrative username. --password password to administer the domain application server. --host machine name where the domain application server is running. --port port number of the domain application server listening for administration requests. --secure if true, uses SSL/TLS to communicate with the domain application server. --passwordfile file containing the domain application server password. --terse indicates that any output data must be very concise, typically avoiding human-friendly sentences and favoring well- formatted data for consumption by a script. Default is false. --echo setting to true will echo the command line statement on the standard output. Default is false. --interactive if set to true (default), only the required password options are prompted. Example 1: Using list-virtual-servers asadmin> list-virtual-servers --user admin --password adminadmin --host localhost --port 4848 Command list-virtual-servers executed successfully EXIT STATUS
0 command executed successfully 1 error in executing the command asadmin-create-virtual-server(1AS), asadmin-delete-virtual-server(1AS) J2EE 1.4 SDK March 2004 asadmin-list-virtual-servers(1AS)
All times are GMT -4. The time now is 12:08 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy