WebFaction
Community site: login faq
1
1

I run a webstore here at WebFaction using Satchmo, the eCommerce solution for Django. We recently found that our site stopped processing Authorize.net transactions, and after some digging around I finally found the culprit: Satchmo uses the cache to store and retrieve credit card information, and somehow memcached had stopped running in my account.

How can I set up a notification if memcached gets shut down again? Also, why and how would it have been shut down?

asked 28 Apr '12, 10:12

kcharvey
1747
accept rate: 0%


You could run a cronjob to monitor your memcache process. On my personal account, I run the following script via cron. I am not using a socket, but this should still work.

#!/bin/bash

if ps -u username |grep -E 'memcached$' > /dev/null
then
  echo "memcached is running."
else
  echo "starting memcache."
  /usr/bin/memcached -d -m 256 -s $HOME/memcached.sock -P $HOME/memcached.pid
fi

Then my cronjob is set up like this:

*/5 * * * * cd ~/scripts;./memcached_check.sh > /dev/null 2>&1

This will run your script every 5 minutes to check if memcache is running and restart it if it is not.

You could also add to the script to send an email depending on the status.

As for why it would have been shutdown, it could have been that the server was restarted and there is no process to restart your memcached process. Or, in some cases, the processes could have been killed because your processes have gone over your account's memory limit.

Hope that helps.

permanent link

answered 28 Apr '12, 11:15

bmeyer71 ♦♦
1.5k3613
accept rate: 33%

edited 11 Nov '14, 20:07

seanf
12.2k42136

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×910
×34

question asked: 28 Apr '12, 10:12

question was seen: 4,558 times

last updated: 11 Nov '14, 20:07

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2020 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM