Pawan
Pawan

Reputation: 32321

Cron job not being able to start the process

I have the follwoing script which restarts memcache incase its down .

The problem is that , the script runs fine when i run it manually , but when i am making it run through cron job , the memcache is not being started .

#!/bin/bash
ps -eaf | grep 11211 | grep memcached
if [ $? -eq 1 ]
then
echo 'mmecache is down'
memcached -d -u nobody -l 10.1.1.1 -p 11211 -m 2076 -x 10.1.1.2 -v
else
echo "eq 0 - memcache running - do nothing"
fi

I am getting this line under logs for every one minute , but i dont know why memcache is not being started .

echo 'mmecache is down'

echo 'mmecache is down'

echo 'mmecache is down'

Upvotes: 0

Views: 380

Answers (1)

WMR
WMR

Reputation: 12971

This is probably a PATH issue, memcached not being found when run from cron. Try using the full path to memcached.

Upvotes: 2

Related Questions