Grep command giving different result for different users for same command


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Grep command giving different result for different users for same command
# 8  
Old 06-18-2015
Actually I can not pass attribute "Memtable switch count" directly in script because there are many such attributes which will be passed to script and script will provide the values through the command entered in script.

For example I can pass below attributes as variable to grep
Memtable cell count
Memtable data size
Memtable off heap memory used
Memtable switch count
And many more

So next time I might be using script with different attribute
Code:
su -l zabbix -s /bin/bash -c "/opt/zabbix/cassandra.sh tests "Memtable off heap memory used""

Purpose of this is basically zabbix will be making call to this script and output data will be used for monitoring. I will be passing attributes to zabbix through its web interface and zabbix will execute this script for passed attribute.

Hope that clarifies now Smilie

Thanks for your help.
# 9  
Old 06-18-2015
The most likely explanation is that the non root user does not have either permission or authority to run the command.
# 10  
Old 06-18-2015
Below is the suders configuration for zabbix user.
Code:
Defaults:zabbix !requiretty
Cmnd_Alias ZABBIX_CMDS = /opt/zabbix/, /opt/zabbix/cassandra.sh, /bin/grep, /usr/bin/nodetool, /usr/bin/awk, /bin/sed
zabbix ALL = NOPASSWD: ZABBIX_CMDS

These are the commands scripts refers to. Am I missing anything here.?

Thanks,
Pushpraj
# 11  
Old 06-18-2015
Quote:
Originally Posted by Pushpraj
Code:
su -l zabbix -s /bin/bash -c "/opt/zabbix/cassandra.sh tests "Memtable off heap memory used""

That's how the command is parsed. The double quotes are not doing what you think.
Code:
su -l zabbix -s /bin/bash -c '/opt/zabbix/cassandra.sh tests "Memtable off heap memory used"'


Last edited by Aia; 06-18-2015 at 06:20 PM.. Reason: Fixes code quote
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Linux find command seems to not transmit all the result to the '-exec command'

Hello. From a script, a command for a test is use : find /home/user_install -maxdepth 1 -type f -newer /tmp/000_skel_file_deb ! -newer /tmp/000_skel_file_end -name '.bashrc' -o -name '.profile' -o -name '.gtkrc-2.0' -o -name '.i18n' -o -name '.inputrc' Tha command... (3 Replies)
Discussion started by: jcdole
3 Replies

2. Shell Programming and Scripting

CUT command not giving correct result inside loop

Hi, i have a source file and have 3 columns and separated by "|" .i want to split this 3 columns in different variable.When i am executing this values indivisually giving correct result but when the same execute inside a for loop,it's giving issues. Src file(jjj.txt) -------... (8 Replies)
Discussion started by: raju2016
8 Replies

3. Shell Programming and Scripting

Grep result from dd command

Hi, I am running following command in a bash script for testing IO and use grep to get throughput number, but it did not work, it displayed everything: dd if=/dev/zero of=/dev/null bs=1G count=1 oflag=dsync | grep bytes | awk '{print $7}' 1+0 records in 1+0 records out 536870912 bytes... (2 Replies)
Discussion started by: hce
2 Replies

4. Shell Programming and Scripting

If the grep command returns any result set

my intension is to use a grep command inside the shell script and if any row is returned or not.. depending on the resultset i have to code on further. how to check this i mean.. could anyone help me out with the if condition how to use it here !! (4 Replies)
Discussion started by: gotam
4 Replies

5. Shell Programming and Scripting

Use grep result to execute next command

Hi I am trying to run 2 servers using a script one after the other. I start the first one: run.sh -c servername >> jboss_log.txt & Then I have to wait until I see Started message in the log file before I launch the other server. I can't use sleep because I am not sure how long it'll... (5 Replies)
Discussion started by: iririr
5 Replies

6. Linux

acroread command giving error

Hi, When I run the command acroread it is giving error ERROR: Cannot find installation directory. When I look at /usr/local/Adobe/Acrobat7.0/bin/ an exicutable file named acroread is there. When i run ./acroread from that directory it is working . What can i do so that I can give... (3 Replies)
Discussion started by: iamjayanth
3 Replies

7. UNIX for Dummies Questions & Answers

Last Command not giving year

Hi All, i want the last login details along with year. i tried below command but not giving me the year of last login. last <$Userid> | head -1 i heard that if it is current year then it wont display the year else it will display the year. is it so? if yes then , is there any way of... (1 Reply)
Discussion started by: ani_rvce
1 Replies

8. Shell Programming and Scripting

Last Command not giving year

Hi All, i want the last login details along with year. i tried below command but not giving me the year of last login. last <$Userid> | head -1 i heard that if it is current year then it wont display the year else it will display the year. is it so? if yes then , is there any way of... (1 Reply)
Discussion started by: ani_rvce
1 Replies

9. Linux

Terminal Execution By Giving a Command

Hi Guys, I am using Red Hat Linux 5 and GNOME Terminal is available there in the Accessories menu of Applications. But I don't see any run command option which can be used to type the name of the terminal and execute it directly as I used to do it under Mandrake Linux wherein I would type... (2 Replies)
Discussion started by: indiansoil
2 Replies

10. Shell Programming and Scripting

assign subst|grep|sed command result to a variable

Hi, I'm quite new to scripting and I want to modify following line of an existing script: MYVAR=`subst |grep 'L:\\\:' | sed -e 's/.*\\\//'`; What I have to do is to use the content of a variable instead of the constant expression 'L:\\\:' as the grep string to be matched. Assuming I already... (5 Replies)
Discussion started by: snowbiker99
5 Replies
Login or Register to Ask a Question