summaryrefslogtreecommitdiffstats
path: root/Services/memcache/sx/memcache.sh
blob: d963a298922fb9cf06c466dbfafe49fee26fd365 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/bash
export TERM=dumb

# Begin configuration before starting daemonized process
# and start generating host keys
function begin_config {
    echo "=> Begin memcached configuration for host $HOSTNAME"
}

# End configuration process just before starting daemon
function end_config {
    stop_server
    echo "=> End memcached configuration ..."
}

# Start the memcached server in background. Used to perform config
# against the database structure such as user creation
function start_server {
    echo "===> Starting memcached server ..."
    memcached -u daemon -d &
    sleep 8
}

# Stop the memcached server running in background. 
function stop_server {
    echo "===> Stopping memcached server ..."
    killall memcached
    sleep 8
}

# Start the memcached server as a deamon and execute it inside 
# the running shell
function start_daemon {
    echo "=> Starting memcached daemon ..."
    exec memcached -u daemon
}


if [[ "$0" == *"memcached.sh" && ! $1 = "" ]];then
    eval "$@"; 
fi