help in setting up values


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting help in setting up values
# 1  
Old 08-23-2012
help in setting up values

I have server, i want to tune some storage below are my issues.

1. There is a directory

Code:
/sys/block/

There are directories starting with name emcpow* under that there is a directory queue, inside that there is file nr_requests

This is complete path

Code:
/sys/block/emcpowerbj/queue/nr_requests

i want to change all "[/sys/block/emcpow*/queue/nr_requests]" to like that

Code:
echo "100000" > /sys/block/emcpow*/queue/nr_requests

2. same thing i want to apply to all emcpow*

Code:
echo "noop" > /sys/block/emcpow*/queue/scheduler

3. another thing i want to set all emcpow* value to /dev/emcpow* to like that

Code:
blockdev --setra 16384 /dev/emcpow*

---------- Post updated at 12:19 PM ---------- Previous update was at 12:18 PM ----------

point 1 & 2 are almost same, but different is point 3. Please help me out.
# 2  
Old 08-23-2012
The 'for' loop can do what you want.

Code:
for BLOCK in /sys/block/emcpow*
do
        echo "100000" > "$BLOCK"/queue/nr_requests
        echo "noop" > "$BLOCK"/queue/scheduler
done

#3 can be solved similarly.
This User Gave Thanks to Corona688 For This Post:
# 3  
Old 08-23-2012
will below code is fine?

Code:
for BLOCK in /dev/emcpow*

do
       blockdev --setra 16384 "$BLOCK"

done

---------- Post updated at 01:56 PM ---------- Previous update was at 01:55 PM ----------

how can i write above two codes in

1) perl
2) python
# 4  
Old 08-23-2012
Yes, that code looks correct.

I don't see any point doing so in perl, the program would be huge and would end up running 99% shell code anyway.

I don't know Python too well.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Reading properties from file and setting variable values

I want to read properties from a file and print evaluated values of each key. I am using AIX6.1. myfile.props protocol=http siteA.host=siteAhostname pageA=pageNameA siteAURL1=${protocol}:/${siteA.host}/pagea/blabla?v1=32 siteAURL2=${protocol}:/${siteA.host}/${pageA}/blabla?v1=32... (5 Replies)
Discussion started by: kchinnam
5 Replies

2. Shell Programming and Scripting

Bash: Setting default values for variables

I have a variable I want to use in bash script. The user will pass an argument to the script and I will store it in `arg_fql`. If the user does not pass the variable, I still never set arg_fql, but I set another variable to a default. However, if the user passes a value, `arg_fql` will be set to... (2 Replies)
Discussion started by: kristinu
2 Replies

3. Shell Programming and Scripting

Reading multiple values from multiple lines and columns and setting them to unique variables.

Hello, I would like to ask for help with csh script. An example of an input in .txt file is below, the number of lines varies from file to file and I have 2 or 3 columns with values. I would like to read all the values (probably one by one) and set them to independent unique variables that... (7 Replies)
Discussion started by: FMMOLA
7 Replies

4. Solaris

Is there a difference between setting a user as nologin and setting it as a role?

Trying to figure out the best method of security for oracle user accounts. In Solaris 10 they are set as regular users but have nologin set forcing the dev's to login as themselves and then su to the oracle users. In Solaris11 we have the option of making it a role because RBAC is enabled but... (1 Reply)
Discussion started by: os2mac
1 Replies

5. Shell Programming and Scripting

Query the table and return values to shell script and search result values from another files.

Hi, I need a shell script, which would search the result values from another files. 1)execute " select column1 from table_name" query on the table. 2)Based on the result, need to be grep from .wft files. could please explain about this.Below is the way i am using. #!/bin/sh... (4 Replies)
Discussion started by: Rami Reddy
4 Replies

6. Shell Programming and Scripting

Converting odd values to even values(or vice-versa) located in a column

Hello All, I have a below data in a .csv file where all rows where col1 is A, col2 is odd numbers, similarly even numbers for all rows where col1 is B. Note that my data has some other columns(not shown here) too (around 100) after col2. Tool,Data A,1 A,3 A,5 .... so on B,2 B,4 .... ... (4 Replies)
Discussion started by: ks_reddy
4 Replies

7. Shell Programming and Scripting

Compare values in two files. For matching rows print corresponding values from File 1 in File2.

- I have two files (File 1 and File 2) and the contents of the files are mentioned below. - I am trying to compare the values of Column1 of File1 with Column1 of File2. If a match is found, print the corresponding value from Column2 of File1 in Column5 of File2. - I tried to modify and use... (10 Replies)
Discussion started by: Santoshbn
10 Replies

8. Programming

Reading command line arguments and setting up values if option not provided

I have a C++ program. I read command line arguments, but if the value is not supplied, I default or make a calculation. Let's say I set it to a default value. I can code this in several ways. Here I show three ways. What would be the best way for maintaining this code? The program will get very... (2 Replies)
Discussion started by: kristinu
2 Replies

9. Shell Programming and Scripting

How to pick values from column based on key values by usin AWK

Dear Guyz:) I have 2 different input files like this. I would like to pick the values or letters from the inputfile2 based on inputfile1 keys (A,F,N,X,Z). I have done similar task by using awk but in that case the inputfiles are similar like in inputfile2 (all keys in 1st column and values in... (16 Replies)
Discussion started by: repinementer
16 Replies

10. Shell Programming and Scripting

Setting values in an array? Easy one

I need to do something like this: KEYS= for key in $KEYS do echo $key done The KEYS are static values in my script, I'm just having trouble with setting them as separate values. Thanks! (3 Replies)
Discussion started by: TheCrunge
3 Replies
Login or Register to Ask a Question