/opt/eduserver/eduserver
gives me options:
Usage: /opt/eduserver/eduserver {start|stop|startphp|startwww|startooo|stopphp|stopwww|stopooo|restartphp|restartwww|restartooo|status|restart|reload|force-reload}
where memcache is php module there is memcache.ini
in /opt/eduserver/etc/php/conf.d
.
I want to clear the memcache from command line. Can I do it somehow without 'touching' any other part of the web server?
yes. you can clear the memcache. try:
if the memcache does not run on localhost 11211, you will have to adjust it.
This will also work using netcat
Then just wait for the "OK".
memcflush
in the memcache tools is what you want:Change
localhost
to whatever your server is.The memcache tools may not be installed on the server, if you're running a Debian-based OS you can install it like this:
In Bash you may use this fancy syntax:
Otherwise use
memflush
command:(sleep 2; echo flush_all; sleep 2; echo quit; ) | telnet 127.0.0.1 11211
if you want to run it non-interactively
thanks to @heiko
Rather than waiting for timeouts you can make the command instantaneous by following
flush_all
with thequit
command:printf "flush_all\r\nquit\r\n" | nc localhost 11211
Alternatively if you don't have
nc
:printf "flush_all\r\nquit\r\n" > /dev/tcp/127.0.0.1/11211
Though this method won't produce an output, although you can verify it works by checking
stats
to see thatcmd_flush
increased.in case you use a socket for connecting to memcached the syntax is
echo "flush_all" | nc -U ~/memcached.sock
Here is a function to flush memcached via PHP, in case that you need to refresh it without logging into ssh...
You can just http://yourserver.com/memflush.php
Call this file memflush.php