Solved

shell script

Posted on 2014-02-13
5
408 Views
Last Modified: 2014-03-15
basically i have to modify the file and change a paramter as well as run gmake and confirm it is successfully.

Can some one assist on how to write a script for this below.

cd /usr/local/src/postgresql-8.2.10/src/include

vi pg_config_manual.h (vi this file)

##change to 32768
/*#define BLCKSZ        8192*/                                                                        
#define BLCKSZ  32768                                                                         

cd /usr/local/src/postgresql-8.2.10

gmake
0
Comment
Question by:ittechlab
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 84

Expert Comment

by:ozo
ID: 39857734
sed -i 's/#define BLCKSZ        8192/#define BLCKSZ  32768/' /usr/local/src/postgresql-8.2.10/src/include/pg_config_manual.h
0
 

Author Comment

by:ittechlab
ID: 39859119
here is what i get when i grep BLCKSZ on that file

i did execute the above command. not working .please advise  

* BLCKSZ must be a power of 2.  The maximum possible value of BLCKSZ
 * Changing BLCKSZ requires an initdb.
#define BLCKSZ  8192
 * BLCKSZ; relations bigger than that are divided into multiple files.
 * RELSEG_SIZE * BLCKSZ must be less than your OS' limit on file size.
#define RELSEG_SIZE (0x40000000 / BLCKSZ)
 * Size of a WAL file block.  This need have no particular relation to BLCKSZ.
 * XLOG_BLCKSZ must be a power of 2, and if your system supports O_DIRECT I/O,
 * XLOG_BLCKSZ must be a multiple of the alignment requirement for direct-I/O
 * Changing XLOG_BLCKSZ requires an initdb.
#define XLOG_BLCKSZ             8192
 * and larger than XLOG_BLCKSZ (preferably, a great deal larger than
 * XLOG_BLCKSZ).
 * pg_proc's index; BLCKSZ larger than 8K would allow more).  Values larger
0
 

Author Comment

by:ittechlab
ID: 39859144
[root@rhel5 scripts]# sed 's/#define BLCKSZ 8192/#define BLCKSZ  32768/' /usr/local/src/postgresql-8.2.10/src/include/pg_config_manual.h

when i run the above command its not working. its giving so much line of output. without trying to edit the file i am trying to see if its finding the changes first.
0
 

Author Comment

by:ittechlab
ID: 39859166
[root@rhel5 scripts]# grep '#define BLCKSZ' /usr/local/src/postgresql-8.2.10/src/include/pg_config_manual.h
#define BLCKSZ  8192

[root@rhel5 scripts]# grep '#define BLCKSZ  8192' /usr/local/src/postgresql-8.2.10/src/include/pg_config_manual.h

why grep is not picking up exact word with 8192. I even put the right number of spaces.
0
 
LVL 27

Accepted Solution

by:
skullnobrains earned 500 total points
ID: 39886605
sed -n 's/#define BLCKSZ[[:space:]][[:space:]]*8192/#define BLCKSZ  32768/' /usr/local/src/postgresql-8.2.10/src/include/pg_config_manual.h

will show you the changes

sed -i tmp 's/^#define[[:space:]][[:space:]]*BLCKSZ[[:space:]][[:space:]]*8192/#define BLCKSZ  32768/' /usr/local/src/postgresql-8.2.10/src/include/pg_config_manual.h

will edit the file inplace (using a .tmp for the temp file)

you probably don't care about the default value for BLKSZ so this would be simpler

sed -i tmp 's/^#define[[:space:]][[:space:]]*BLCKSZ.*/#define BLCKSZ  32768/' /usr/local/src/postgresql-8.2.10/src/include/pg_config_manual.h
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question