Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

shell script

Posted on 2014-02-13
5
Medium Priority
?
419 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 1500 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
The purpose of this article is to demonstrate how we can use conditional statements using Python.
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.
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.
Suggested Courses

636 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