Solved

shell script

Posted on 2014-02-13
5
402 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
  • 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 26

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

If you have a server on collocation with the super-fast CPU, that doesn't mean that you get it running at full power. Here is a preamble. When doing inventory of Linux servers, that I'm administering, I've found that some of them are running on l…
Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
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…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

912 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now