chkserv.d mutiple commands per service???

x-man

Well-Known Member
Jan 25, 2004
118
1
166
I have big problem with mysql+memcached, if mysql crash for few seconds, php/apache continue to work and because I have bad php cms it simple caching bad things because can`t get data from mysql and when mysql again start to work (auto restart with chkserv) I have blank homepage because I have bad cache in memcached!

Now I want to auto reload memcached after mysql restart, is it possible?

in /etc/chkserv.d for mysql I have this:
service[mysql]=x,x,x,/usr/local/cpanel/scripts/restartsrv_mysql;/etc/init.d/memcached reload,mysql,mysql

but this simple don`t working, mysql start to work but memcached not reloaded after it, look like second command "/etc/init.d/memcached reload" not executed because mysql start to work after first command!? Is this true or I have some other problem?

How to reload memcached after mysql start/re-start?

Thanks.
 

kernow

Well-Known Member
Jul 23, 2004
1,031
62
178
cPanel Access Level
Root Administrator
Instead of "reload" try restart:
Code:
/etc/init.d/memcached restart
Mysql is extremely stable usually, so you should try to figure out why its crashing. Check you logs.
 

x-man

Well-Known Member
Jan 25, 2004
118
1
166
reload command working fine but look like chkserv simple stop with first command (mysql restart) if mysql start to work...

I need this because mysql sometimes crashing because on backup TOTAL RAM usage go up from <20GB to over 30GB and mysql process virutal mem usage go up to 25GB+ from ~10GB, I still checking why, in my.cnf I have set total maximum memory usage ~20GB , result from tuning-primer.sh:
MEMORY USAGE
Max Memory Ever Allocated : 9.87 G
Configured Max Per-thread Buffers : 10.35 G
Configured Max Global Buffers : 9.51 G
Configured Max Memory Limit : 19.86 G
Physical Memory : 31.32 G
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,260
463
I recommend resolving the issue that is causing MySQL to fail that often. You may want to post on our Optimization forums for assistance with troubleshooting the MySQL failures.

Thank you.
 

x-man

Well-Known Member
Jan 25, 2004
118
1
166
Yes, I need to fix it but also I need option to execute multiple commands per service in chkserv.d, is that possible?
On every mysql restart/start I need to reload memcached, is that possible?

Thanks.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,260
463
You could try using the "&" symbol rather than a comma when adding the additional command. EX:

Code:
/usr/local/cpanel/scripts/restartsrv_mysql & /etc/init.d/memcached reload
Or, you could manually edit "/usr/local/cpanel/scripts/restartsrv_mysql" to reload memcached.

Thank you.