Link to home
Start Free TrialLog in
Avatar of ittechlab
ittechlabFlag for Canada

asked on

shell script

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
Avatar of ozo
ozo
Flag of United States of America image

sed -i 's/#define BLCKSZ        8192/#define BLCKSZ  32768/' /usr/local/src/postgresql-8.2.10/src/include/pg_config_manual.h
Avatar of ittechlab

ASKER

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
[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.
[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.
ASKER CERTIFIED SOLUTION
Avatar of skullnobrains
skullnobrains

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial