summaryrefslogtreecommitdiffstats
path: root/memcached.sysv
diff options
context:
space:
mode:
Diffstat (limited to 'memcached.sysv')
-rwxr-xr-xmemcached.sysv10
1 files changed, 7 insertions, 3 deletions
diff --git a/memcached.sysv b/memcached.sysv
index 62ac51f..19e5a12 100755
--- a/memcached.sysv
+++ b/memcached.sysv
@@ -37,9 +37,13 @@ lockfile=${LOCKFILE-/var/lock/subsys/memcached}
start () {
echo -n $"Starting $prog: "
- # Ensure that /var/run/memcached has proper permissions
- if [ "`stat -c %U /var/run/memcached`" != "$USER" ]; then
- chown $USER /var/run/memcached
+ # Ensure that $pidfile directory has proper permissions and exists
+ piddir=`dirname $pidfile`
+ if [ ! -d $piddir ]; then
+ mkdir $piddir
+ fi
+ if [ "`stat -c %U $piddir`" != "$USER" ]; then
+ chown $USER $piddir
fi
daemon --pidfile ${pidfile} memcached -d -p $PORT -u $USER -m $CACHESIZE -c $MAXCONN -P ${pidfile} $OPTIONS