Sponsored Content
Top Forums Shell Programming and Scripting Redirect output to a different text file depending source of data Post 302672667 by spartan22 on Tuesday 17th of July 2012 10:10:02 AM
Old 07-17-2012
Quote:
Originally Posted by Corona688
Smilie

Which is which?
Input listed below. Sorry about that.

'ans_listzones channel=site1-ddns01 slave'

The site name (site1-ddns01) is dictated by the input file.

---------- Post updated 07-17-12 at 10:10 AM ---------- Previous update was 07-16-12 at 05:38 PM ----------

I figured it out. Here's what I did...


Code:
#!/bin/bash
# Name: DNS Master Slave Zone Dump
# Purpose: Script is responsible for determining which zones are in which view across the DNS platform.

#References text file that contains server names
while read i; do

#Creates text file named after server
echo "Master" > $i.txt

#list all zones in dns in the master db and outputs to text file
echo "ans_listzones channel=$i master >> $i.txt"

#creates seperation within the file for the slave zones
echo "Slave" >> $i.txt

#list all zones in dns in the slave db outputs to text file
echo "ans_listzones channel=$i slave >> $i.txt"

#ends scirpt and directs input file
done < dns

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

redirect output to file?

Hi: I am currently working on a program which requires direct its ouput to a file here is an example ./proram arg_1 arg_2 when program ends all output will be arg_2 file Is that possible I am not a bad programmer, However I am stuck there. Can anyone give a hint? Thanks SW (1 Reply)
Discussion started by: slackware
1 Replies

2. UNIX for Dummies Questions & Answers

Redirect output to a file

Ahhhrrrggg I'm having a brain fart... I want to take the output of a command and redirect it to a file... This works.... $ man cp | cat >> copy_help but this doesn't keytool -help |cat >> keytool_help It just produces... these lines... more keytool_help ] ... ... (11 Replies)
Discussion started by: jimmyc
11 Replies

3. UNIX for Dummies Questions & Answers

redirect output to a file name

Hi all!! is possible to assign the output of some command to filename, i.e. grep_output.txt Otherwise, I want to open a new file which name is inside another, how can I do it? Thanks a lot! (7 Replies)
Discussion started by: csecnarf
7 Replies

4. Shell Programming and Scripting

Insert text into file depending on variable

Hey guys , i have a variable with the contents ... NUMBER=4 and a test file with the contents 1248 1213 1214 1278 1200 3045 3444 2130 I want to execute a script that will produce the following output ( based on NUMBER=4) to be ... create 1248 (1 Reply)
Discussion started by: theshams
1 Replies

5. Shell Programming and Scripting

How to redirect output of ls to a file?

Hi All, I want to redirect only the file names to a new file from the ls -ltr directroy. how Can i do it. my ls -ltr output will be as below. -rwxr-xr-x 1 118 103 28295 Jul 26 2006 event.podl -rwxr-xr-x 1 118 103 28295 Jul 26 2006 xyz.podl I want my new file... (6 Replies)
Discussion started by: girish.raos
6 Replies

6. Shell Programming and Scripting

How to split a data file into separate files with the file names depending upon a column's value?

Hi, I have a data file xyz.dat similar to the one given below, 2345|98|809||x|969|0 2345|98|809||y|0|537 2345|97|809||x|544|0 2345|97|809||y|0|651 9685|98|809||x|321|0 9685|98|809||y|0|357 9685|98|709||x|687|0 9685|98|709||y|0|234 2315|98|809||x|564|0 2315|98|809||y|0|537... (2 Replies)
Discussion started by: nithins007
2 Replies

7. UNIX for Dummies Questions & Answers

Mapping a data in a file and delete line in source file if data does not exist.

Hi Guys, Please help me with my problem here: I have a source file: 1212 23232 343434 ASAS1 4 3212 23232 343434 ASAS2 4 3234 23232 343434 QWQW1 4 1134 23232 343434 QWQW2 4 3212 23232 343434 QWQW3 4 and a mapping... (4 Replies)
Discussion started by: kokoro
4 Replies

8. Shell Programming and Scripting

script to mail monitoring output if required or redirect output to log file

Below script perfectly works, giving below mail output. BUT, I want to make the script mail only if there are any D-Defined/T-Transition/B-Broken State WPARs and also to copy the output generated during monitoring to a temporary log file, which gets cleaned up every week. Need suggestions. ... (4 Replies)
Discussion started by: aix_admin_007
4 Replies

9. Shell Programming and Scripting

Redirect script output to a file and mail the output

Hi Guys, I want to redirect the output of 3 scripts to a file and then mail the output of those three scripts. I used below but it is not working: OFILE=/home/home1/report1 echo "report1 details" > $OFILE =/home/home1/1.sh > $OFILE echo... (7 Replies)
Discussion started by: Vivekit82
7 Replies

10. Shell Programming and Scripting

Compare output of UNIX command and match data to text file

I am working on an outage script and I run a command from the command line which tells me the amount of generator failures in my market. The output of this command only gives me three digits to identify the site by. I have a master list of all sites in a separate file, call it list.txt. If my... (7 Replies)
Discussion started by: jbrass
7 Replies
SMOKEPING_MASTER_SLAVE(7)					     SmokePing						 SMOKEPING_MASTER_SLAVE(7)

NAME
smokeping_master_slave - How to run multiple distributed instances of SmokePing OVERVIEW
Normally smokeping probes run their tests from the host where smokeping runs to some target host and monitor the latency of the connection between the two. The Master/Slave concept enables all smokeping probes to run remotely. The use case for this is to measure the overall connectivity in a network. If you are interested in checking that your central DNS server or your file server works for everyone, you could setup several smokeping instances checking up on on the two servers from multiple locations within your network. With the Master/Slave smokeping configuration this process becomes much simpler, as one smokeping master server can control multiple slaves. All monitoring data is stored and presented on the server, but collected by the slaves. The slaves will also get their configuration information from the master, so that you just have to maintain the master server configuration file and the rest is taken care of automatically. DESCRIPTION
Architecture The slaves communicate with the master smokeping server via the normal smokeping web interface. On initial startup each slave connects to the master server and asks for its assignments. When the slave has done a round of probing it connects to the master again to deliver the results. If the assignment for a slave changes, the master will tell the slave after the slave has delivered its results. The master and the slaves sign their messages by supplying an HMAC-MD5 code (RFC 2104) of the message and a shared secret. Optionally the whole communication can run over ssl. [slave 1] [slave 2] [slave 3] | | | +-------+ | +--------+ | | | v v v +---------------+ | master | +---------------+ The slave is a normal smokeping instance setup where the configuration comes from the master instead of a local configuration file. The slave tries to contact the master server after every round of probing, supplying its results. If the master server can not be reached, the results will be sent to the server together with the next round of results. Results will be stored in a file in Perl storable form so that they survive a restart of the smokeping instance. Master Configuration To configure a master/slave setup, add a slaves section to your smokeping configuration file. Each slave has a section in the slaves part of the master configuration file. The section name must match the hostname of the slave. If some configuration parameter must be set to a special value for the slave, use an override section to configure this. The slave names must be the names the hosts think they have, not their outside hostnames or ip addresses or anything like that. When the slave calls the master to get its config or report its measurements it will tell the master its 'hostname'. This together with the shared secret is used to authenticate and identify who is who. *** Slaves *** secrets=/etc/smokeping/slavesecrets.conf +slave1 display_name=erul22 location=India color=ff0000 ++override Probes.FPing.binary = /usr/bin/fping ... Then in the targets section you can define slaves at every level. Again the settings get inherited by lower order targets and can be overwritten anywhere in the tree. A slave will then get the appropriate configuration assigned by the server. *** Targets *** slaves = slave1 slave2 ... +dest1 slaves = ... +dest2 slaves = slave1 ... +dest3 ... The data from the slaves will be stored in TargetName~SlaveName.rrd. So the example above would create the following files: dest1.rrd dest2.rrd dest2~slave1.rrd dest3.rrd dest3~slave1.rrd dest3~slave2.rrd The slavesecrets.conf file contains a colon separated list of hostnames and secrets. host1:secret1 host2:secret2 Slave Configuration A smokeping slave setup has no configuration file. It just needs to know that it runs in slave-mode and its secret. The secret is stored in a file for optimal protection. By default the persistent data cache will be located in /tmp/smokeping.$USER.cache. ./smokeping --master-url=http://smokeping/smokeping.cgi --cache-dir=/var/smokeping/ --shared-secret=/var/smokeping/secret.txt The secret.txt file contains a single word, the secret of this slave. It is NOT the same as the slavesecrets.conf file the master uses. SECURITY CONSIDERATIONS
The master effectively has full access to slave hosts as the user running the slave smokeping instance. The configuration is transferred as Perl code that is evaluated on the slave. While this is done inside a restricted "Safe" compartment, there are various ways that a malicious master could embed arbitrary commands in the configuration and get them to run when the slave probes its targets. The strength of the shared secret is thus of paramount importance. Brute forcing the secret would enable a man-in-the-middle to inject a malicious new configuration and compromise the slave. COPYRIGHT
Copyright (c) 2007 by Tobias Oetiker, OETIKER+PARTNER AG. All right reserved. LICENSE
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. AUTHOR
Tobias Oetiker <tobi@oetiker.ch> 2.6.8 2012-02-26 SMOKEPING_MASTER_SLAVE(7)
All times are GMT -4. The time now is 09:01 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy