memcached.init 582 B

123456789101112131415161718192021222324252627
  1. #!/bin/sh /etc/rc.common
  2. # Copyright (C) 2010-2011 OpenWrt.org
  3. START=80
  4. start_instance () {
  5. local section="$1"
  6. config_get user "$section" user
  7. config_get maxconn "$section" maxconn
  8. config_get listen "$section" listen
  9. config_get port "$section" port
  10. config_get memory "$section" memory
  11. service_start /usr/bin/memcached -d -u ${user:-nobody} \
  12. -c ${maxconn:-1024} -l ${listen:-0.0.0.0} \
  13. -p ${port:-11211} -U ${port:-11211} -m ${memory:-64}
  14. }
  15. start() {
  16. config_load 'memcached'
  17. config_foreach start_instance 'memcached'
  18. }
  19. stop() {
  20. service_stop /usr/bin/memcached
  21. }