I would like to make crontab run this script as a regular user:
#!/usr/bin/env bash
PIDFILE=wp-content/uploads/sphinx/var/log/searchd.pid
if ! test -f ${PIDFILE} || ! kill -s 0 `cat ${PIDFILE}`; then
`which searchd` --config /home/user/www/wordpress-page/wp-content/uploads/sphinx/sphinx.conf
fi
It simply reruns Sphinx Search daemon, because my shared server kills all my daemons if anything exceeds 1GB of ram (its Webfaction).
When I call that script by hand via CLI command it works, but if I attach it in crontab (using crontab -e
) I got an email with an error
which: no searchd in (/usr/bin:/bin)
/home/user/www/wordpress-page/run-searchd.sh: line 8: --config: command not found
Simply which searches root level, but I would like it to behave as called by myself when I log in via ssh as regular user. How to make that happen?