Solved

shell script

Posted on 2014-02-13
5
404 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 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

840 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