Hi, Im new with bash scripting and I want to create a conditional emailing with bash scripting. But it doesn't workout.
the conditional requirement are; if the TextDecoded value from inbox table are not the same with sms_keyword value from kontak_group table then don't email.
It keep emailing whether it meet or not using the requirements above.
mailx will run as long as there is some output coming thru the pipe regardless of whether or not it is what you expected ... you may want to put the mysql output into a variable, check that variable value and then pipe to mailx if appropriate (code sample below may need your tweaking)...
Last edited by Just Ice; 06-15-2013 at 03:39 AM..
Reason: code tags
i'm thinking your mysql command is putting out extraneous info ... see if you can redirect the unneeded info (i.e., CHECKER=$(some_command | some_command 2> /dev/null) ... echo out the value of $CHECKER to make sure are only getting what you need ...
also, check your egrep output and see if HCS or ADM will not show HCS ADM ...
you could also combine your blocks to make the script shorter (see below) ...
Hi All,
i have a table in mysql with the following data
Table name Test
Assettype Serial_No Status location
Mouse 123456 In Stock chennai
Mouse 98765 Allocated chennai
Keyboard ... (2 Replies)
Hi All,
The following databse table maintains
VENDOR and EMAIL details.
VENOR_NAME VENDOR_EMAIL
DELL surendra@dell.com
HP rajkamal@hp.com
ACER sumathi@acer.com
NOKIA kunal@nokia.com
SONY sinu@sony.com
We have to find emaild id of a vendor based... (7 Replies)
I think(hope) I've got a simple one - I just need to send an email if a mysql query returns any results (ideally - it will never match).
Currently I just pipe the mysql query output to the mail program, but of course that emails regardless of the output( and I check this every 10 minutes from... (5 Replies)
Hello
i have created mysql query to compare to values and get difference in percentage
as following:
SELECT file_name, 100 - ((100 * (SELECT file_count FROM xipi_files z WHERE x.file_group = z.file_group AND x.file_name = z.file_name AND z.insert_date = CURDATE( ) - INTERVAL 1 DAY)) /... (1 Reply)
Hi,
I want to access mysql query from database , for that i have tried the below code
#! /bin/bash
TABLE_NAME=database1
USER_NAME=root
IP_ADDR=111.20.9.256
somevar=`echo "select altid from alert where altid='2724'"| mysql -h $IP_ADDR -u $USER_NAME $TABLE_NAME `
echo $somevar
... (1 Reply)
hello all
i have 2 columns every column in the following format
column1
2011-04-01 11:39:54
column2
2019-02-03 00:00:00
i want get difference between above data as following
2 days 11:39
how to do so ?
i tried many functions but nothing works
please advice what is the query... (6 Replies)
Hi there, I have a table that stores multiple records for many different servers, each of which is timestamped ... I wanted to write a query that would enable me to only output the "latest" record (based on timestamp) for each "unique" server. So for example my main table looks like this
... (3 Replies)
Hi there,
I have a hierarchical database that include 4 tables. Table A is the parent of B, B is Parent of C, C is parent of D. If I want to query everything in D that is associated with A.name, how do I do that? Thanks!
YanYan (0 Replies)