Sponsored Content
Top Forums Shell Programming and Scripting Conditional emailing with mysql query Post 302822093 by Just Ice on Monday 17th of June 2013 12:36:51 AM
Old 06-17-2013
i was just looking at this again and not seeing the mysql comand output that you showed as an example ... it seems your issue is that your script does not run the mysql command like alister said though not because of your command ... it looks like you are using single quotes instead of backticks when setting the CHECKER variable ... i also added the error redirect to /dev/null so you see less errors ...

change this ...
Code:
CHECKER='mysql -u root --password=123456 smsd -e "SELECT ID, SenderNumber, TextDecoded FROM inbox ORDER BY ReceivingDateTime DESC LIMIT 1  \G" |egrep -w 'ADM|BS|HC|IRC|IT|PTM|HCS''

to this ...
Code:
CHECKER=$(mysql -u root --password=123456 smsd -e "SELECT ID, SenderNumber, TextDecoded FROM inbox ORDER BY ReceivingDateTime DESC LIMIT 1  \G" |egrep -w 'ADM|BS|HC|IRC|IT|PTM|HCS' 2> /dev/null)

or this ...
Code:
CHECKER=`mysql -u root --password=123456 smsd -e "SELECT ID, SenderNumber, TextDecoded FROM inbox ORDER BY ReceivingDateTime DESC LIMIT 1  \G" |egrep -w 'ADM|BS|HC|IRC|IT|PTM|HCS' 2> /dev/null`

This User Gave Thanks to Just Ice For This Post:
 

8 More Discussions You Might Find Interesting

1. Programming

How to query one to many mysql

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)
Discussion started by: pinkgladiator
0 Replies

2. Shell Programming and Scripting

mysql help : query with 2 conditionals

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)
Discussion started by: hcclnoodles
3 Replies

3. Web Development

mysql query help

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)
Discussion started by: mogabr
6 Replies

4. Shell Programming and Scripting

mysql query in shellscript

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)
Discussion started by: aish11
1 Replies

5. Programming

mysql query help

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)
Discussion started by: mogabr
1 Replies

6. Shell Programming and Scripting

Conditional bash/mysql query help

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)
Discussion started by: jcass78
5 Replies

7. Shell Programming and Scripting

Need help on conditional emailing

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)
Discussion started by: ROCK_PLSQL
7 Replies

8. Programming

Need help in mysql query

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)
Discussion started by: venkitesh
2 Replies
smsd(8) 						      System Manager's Manual							   smsd(8)

NAME
smsd - The SysMan Station daemon SYNOPSIS
/usr/sbin/smsd OPTIONS
Runs smsd as a daemon. This creates a separate process and redirects output to the smsd log files. DESCRIPTION
The SysMan Station is a client-server application consisting of a daemon (smsd) and the SysMan Station graphical user interface (sys- man_station(8)). The SysMan Station provides the ability to monitor and manage a single system or a TruCluster system. The smsd server is responsible for gathering system management data from the host and presenting that information to the SysMan Station client. SysMan Station management data is collected from the following sources: Desktop Management (DMI) - software related management data Common Hardware - hardware related management data Event Management (EVM) - event data SMS data files - SMS configuration data RESTRICTIONS
You must have root privileges to run this command. EXAMPLES
The following example shows how to run the System Management Station daemon: /sbin/init.d/smsd start FILES
The SysMan Station daemon The directory containing SysMan Station data files SysMan Station log files SEE ALSO
Commands: sysman_station(8) System Administration smsd(8)
All times are GMT -4. The time now is 02:11 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy