The Web server uses memcached, but does not know why memcached always hangs (basic 20 minutes ~ 50 minutes), causes some website page to visit the time error; When you define the log, you cannot see what ; Preliminary determination is related to the prior update of libevent. Because the online server, so first with the foot to make up for the next
#!/bin/sh
pid= ' ps aux|grep-v grep|grep Memcached|awk ' {print $} ' memcached=
'/usr/local/memcached/bin/ Memcached-u www & '
nginx= '/usr/local/nginx/sbin/nginx-s Reload & '
if [-Z ' $pid]
then
echo $ Memcached
echo $nginx
fi
The above script mainly temperature 2 knowledge points, one is awk, one is the conditional expression of if, of course, those single quotes, double quotes, special single quotes are annoying. Just a basic script, very vegetable, but can realize I want the function, first judge memcached process exists, if not exist then start memcached and overload Nginx.
Finally added to the system task, every 5 minutes to determine:
*/15 * * * */root/memcached.sh
Completed!
As for the if conditional expression, there are more, you can search the Internet to see, here is not repeated.