Sponsored Content
Top Forums Shell Programming and Scripting How to get rid of extra enter at the end??? Post 302225171 by alirezan on Thursday 14th of August 2008 06:46:30 PM
Old 08-14-2008
How to get rid of extra enter at the end???

Hi guys,

I want to automate a few tasks. For one of them, I need to get the output of a command and parse it to extract information I need: drbdadm create-md drbd0

The output is:

md_offset 48010952704
al_offset 48010919936
bm_offset 48009453568

Found ext2 filesystem which uses 18563076 kB
current configuration leaves usable 46884232 kB

==> This might destroy existing data! <==

Do you want to proceed?
[need to type 'yes' to confirm]

Now, I need to enter no at this stage so that I could get the size only. What I do is:

Quote:
test=`drbdadm create-md drbd0 | grep "current configuration leaves usable"` << MAYDAY
no

MAYDAY
But, this requires me to press enter at the command prompt before it finishes the execution.

How do I get rid of that extra enter? Anybody? please help!

Thanks
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need UNIX shell scripting end to end information

Hi, I would like to learn shell scripting in UNIX. Can any one please give me the support and share the information/documents with me. If any documents please post it to aswanikumar_nimmagadda@yahoo.co.in Thanks in advance...!!! (3 Replies)
Discussion started by: aswani_n
3 Replies

2. Shell Programming and Scripting

How to enter a newline after every XML tag end?

Hi Guyz, I have an XML message in following format: I want my contents to be formatted in following order: i.e. I want a newline after every XML tag end. How to do this? Thnx in advance. (5 Replies)
Discussion started by: DTechBuddy
5 Replies

3. Shell Programming and Scripting

awk get rid of space in end of field

Hello. I'm using a file to "grep" in a 2nd one (with awk) cat file1 2 first user 9 second user 1 third user (with a space after user) I want to get the line except the 1st field so I do : field=$(gawk '{$1 =""; print $0}' file | sed 's/^ //') It works but it deletes... (5 Replies)
Discussion started by: xanthos
5 Replies

4. UNIX for Dummies Questions & Answers

Enter data at end of a file

Hi All, I have a sample datafile: 5.1 5.2 0.8 6.1 What I want to do is create an additional 3 rows with the number "0.7". so that I now have: 5.1 5.2 0.8 6.1 0.7 0.7 (3 Replies)
Discussion started by: tintin72
3 Replies

5. Shell Programming and Scripting

Use of Begin IF ,END IF END not working in the sql script

Hi I have written a script .The script runs properly if i write sql queries .But if i use PLSQL commands of BEGIN if end if , end ,then on running the script the comamds are getting printed on the prompt . Ex :temp.sql After connecting to the databse at the sql prompt i type... (1 Reply)
Discussion started by: isha_1
1 Replies

6. Shell Programming and Scripting

my shell now adds extra space at end of each line!

Hi, Since today, with csh or tcsh, if I do 'ls files* > list', every lines end with an extra space! What happenned? What can I do to go back when there was no extra space? If I change to bash, there's no extra space. Thanks, Patrick ---------- Post updated at 03:19 PM... (1 Reply)
Discussion started by: trogne
1 Replies

7. Shell Programming and Scripting

Loop logic, enter into respective IF as per enter input file name

have three big data file, however I just need to see the mentioned below one line form the all the file which has SERVER_CONNECTION Value File 1 export SERVER_CONNECTION=//dvlna002:10001/SmartServer File2 export SERVER_CONNECTION=///SmartServer File3 export... (1 Reply)
Discussion started by: Nsharma3006
1 Replies

8. UNIX Desktop Questions & Answers

To remove the extra spaces at the end of each line in a file

I have a file of about 10k records and eace line is having an extra space of 5 byte at the end.. Iwant to remove the extra spaces at the end of each line.. Can someone please help me out.. I tried using sed command and its not working... can someone please help me out. (3 Replies)
Discussion started by: rammohan
3 Replies

9. Shell Programming and Scripting

sed removing extra character from end

Hi, Searching through forum I found "sed 's/*$//'" can be used to remove trailing whitespaces and tabs from file. The command works fine but I see minor issue as below. Can you please suggest if I am doing something wrong here. $ cat a.txt upg_prod_test upg_prod_new $ cat a.txt |sed... (11 Replies)
Discussion started by: bhupinder08
11 Replies
DRBDADM(8)						       System Administration							DRBDADM(8)

NAME
drbdadm - Administration tool for DRBD . SYNOPSIS
drbdadm [-d] [-c {file}] [-t {file}] [-s {cmd}] [-m {cmd}] [-S] [-h {host}] [-- {backend-options}] {command} [all | resource...] DESCRIPTION
Drbdadm is the high level tool of the DRBD program suite. Drbdadm is to drbdsetup and drbdmeta what ifup/ifdown is to ifconfig. Drbdadm reads its configuration file and performs the specified commands by calling the drbdsetup and/or the drbdmeta program. OPTIONS
-d, --dry-run Just prints the calls of drbdsetup to stdout, but does not run the commands. -c, --config-file file Specifies the configuration file drbdadm will use. If this parameter is not specified, drbdadm will look for /etc/drbd-83.conf, /etc/drbd-08.conf and /etc/drbd.conf. -t, --config-to-test file Specifies an additional configuration file drbdadm to check. This option is only allowed with the dump and the sh-nop commands. -s, --drbdsetup file Specifies the full path to the drbdsetup program. If this option is omitted, drbdadm will look for /sbin/drbdsetup and ./drbdsetup. -m, --drbdmeta file Specifies the full path to the drbdmeta program. If this option is omitted, drbdadm will look for /sbin/drbdmeta and ./drbdmeta. -S, --stacked Specifies that this command should be performed on a stacked resource. -P, --peer Specifies to which peer node to connect. Only necessary if there are more than two host sections in the resource you are working on. -- backend-options All options following the doubly hyphen are considered backend-options. These are passed through to the backend command. I.e. to drbdsetup, drbdmeta or drbd-proxy-ctl. COMMANDS
attach Attaches a local backing block device to the DRBD resource's device. detach Removes the backing storage device from a DRBD resource's device. connect Sets up the network configuration of the resource's device. If the peer device is already configured, the two DRBD devices will connect. If there are more than two host sections in the resource you need to use the --peer option to select the peer you want to connect to. disconnect Removes the network configuration from the resource. The device will then go into StandAlone state. syncer Loads the resynchronization parameters into the device. up Is a shortcut for attach and connect. down Is a shortcut for disconnect and detach. primary Promote the resource's device into primary role. You need to do this before any access to the device, such as creating or mounting a file system. secondary Brings the device back into secondary role. This is needed since in a connected DRBD device pair, only one of the two peers may have primary role (except if allow-two-primaries is explicitly set in the configuration file). invalidate Forces DRBD to consider the data on the local backing storage device as out-of-sync. Therefore DRBD will copy each and every block from its peer, to bring the local storage device back in sync. invalidate-remote This command is similar to the invalidate command, however, the peer's backing storage is invalidated and hence rewritten with the data of the local node. resize Causes DRBD to re-examine all sizing constraints, and resize the resource's device accordingly. For example, if you increased the size of your backing storage devices (on both nodes, of course), then DRBD will adopt the new size after you called this command on one of your nodes. Since new storage space must be synchronised this command only works if there is at least one primary node present. The --assume-peer-has-space allows you to resize a device which is currently not connected to the peer. Use with care, since if you do not resize the peer's disk as well, further connect attempts of the two will fail. The --assume-clean allows you to resize an existing device and avoid syncing the new space. This is useful when adding addtional blank storage to your device. Example: # drbdadm -- --assume-clean resize r0 check-resize Calls drbdmeta to eventually move internal meta data. If the backing device was resized, while DRBD was not running, meta data has to be moved to the end of the device, so that the next attach command can succeed. create-md Initializes the meta data storage. This needs to be done before a DRBD resource can be taken online for the first time. In case of issues with that command have a look at drbdmeta(8) get-gi Shows a short textual representation of the data generation identifiers. show-gi Prints a textual representation of the data generation identifiers including explanatory information. dump-md Dumps the whole contents of the meta data storage, including the stored bit-map and activity-log, in a textual representation. outdate Sets the outdated flag in the meta data. adjust Synchronizes the configuration of the device with your configuration file. You should always examine the output of the dry-run mode before actually executing this command. wait-connect Waits until the device is connected to its peer device. role Shows the current roles of the devices (local/peer). E.g. Primary/Secondary state Deprecated alias for "role", see above. cstate Shows the current connection state of the devices. status Shows the current status of all devices defined in the current config file, in XML-like format. Example output: <drbd-status version="8.3.2" api="88"> <resources config_file="/etc/drbd.conf"> <resource minor="0" name="s0" cs="SyncTarget" st1="Secondary" st2="Secondary" ds1="Inconsistent" ds2="UpToDate" resynced_precent="5.9" /> <resource minor="1" name="s1" cs="WFConnection" st1="Secondary" st2="Unknown" ds1="Inconsistent" ds2="Outdated" /> <resource minor="3" name="dummy" cs="Unconfigured" /> <!-- resource minor="4" name="scratch" not available or not yet created --> </resources> </drbd-status> dump Just parse the configuration file and dump it to stdout. May be used to check the configuration file for syntactic correctness. outdate Used to mark the node's data as outdated. Usually used by the peer's fence-peer handler. verify Starts online verify. During online verify, data on both nodes is compared for equality. See /proc/drbd for online verify progress. If out-of-sync blocks are found, they are not resynchronized automatically. To do that, disconnect and connect the resource when verification has completed. See also the notes on data integrity on the drbd.conf manpage. pause-sync Temporarily suspend an ongoing resynchronization by setting the local pause flag. Resync only progresses if neither the local nor the remote pause flag is set. It might be desirable to postpone DRBD's resynchronization until after any resynchronization of the backing storage's RAID setup. resume-sync Unset the local sync pause flag. new-current-uuid Generates a new currend UUID and rotates all other UUID values. This can be used to shorten the initial resync of a cluster. See the drbdsetup manpage for a more details. dstate Show the current state of the backing storage devices. (local/peer) hidden-commands Shows all commands undocumented on purpose. VERSION
This document was revised for version 8.3.2 of the DRBD distribution. AUTHOR
Written by Philipp Reisner philipp.reisner@linbit.com and Lars Ellenberg lars.ellenberg@linbit.com REPORTING BUGS
Report bugs to drbd-user@lists.linbit.com. COPYRIGHT
Copyright 2001-2008 LINBIT Information Technologies, Philipp Reisner, Lars Ellenberg. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. SEE ALSO
drbd.conf(5), drbd(8), drbddisk(8), drbdsetup(8), drbdmeta(8) and the DRBD project web site[1] NOTES
1. DRBD project web site http://www.drbd.org/ DRBD 8.3.2 5 Dec 2008 DRBDADM(8)
All times are GMT -4. The time now is 05:48 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy