mardi 24 février 2015

Why scripts run as user but not as a cron?


I have a script that checks to see if port 4000 is open and listening, if it is return true, else start a service that also outputs a logfile. The script runs fine if I execute it as a user, but if I add it as a cron it doesn't run. I'm logged in as root, the script is owned by root, the script has executable permissions, and I am running crontab -e as root.



#!/bin/bash
if lsof -Pi :4000 -sTCP:LISTEN -t >/dev/null ; then
return 1
else
seoserver -p 4000 start > /var/www/vhosts/domain.com/httpdocs/seoserver.log &
fi


And here is my cron



*/5 * * * * /usr/bin/seoStart


Aucun commentaire:

Enregistrer un commentaire