say you need count of records to be monitored
file: count.sql
select count(*) from CONTACT;
and you run,
watch -n1 "mysql -hmysqlhost -umysqluser -pmysqlpassword mydb < count.sql "
using ps axwwf|grep mysql, will display it
watch -n1 mysql -hmysqlhost -umysqluser -pmysqlpassword mydb < count.sql
the better option would be creating options file like .my.cnf for client
but there would be default .my.cnf file existing, if not you can do same.
So we will have our own
file: .my-options.cnf
[client]
user=mysqluser
password=mysqlpassword
host=mysqlhost
database=mydb
set owner read-only, and execute
mysql --defaults-extra-file=~/.my-options.cnf < count.sql
this does show the parameters when done ps, but atleast file-permission will protect it and the parameters are hidden.
if you need to put it in cron-job, specify the full path for the above files.
No comments:
Post a Comment