06-09-2011 11:31 AM
I'm trying this from root cron
50 * * * * "su - wmsusr -c /wms/app/zabbix/check_zabbix.sh"
Works fine if I
# su - wmsusr
Here is the script
value=`ps -fu $HOSTNAME |grep zabbix| grep -v grep| wc -l`
if [ $value -eq 0 ]; then
rm -f /wms/app/zabbix/agentd.pid
/wms/app/zabbix/zabbix_agentd -c /wms/app/zabbix/zabbix_agentd.conf
06-09-2011 01:02 PM
your second output ran as root, did you stop the agent before running the script? If the agent is running, you will see only 1 and 2 right?
06-09-2011 01:33 PM
I believe Wilfred may have found the reason.
You really ought to change the *name* of the variable that holds the *user* id. Calling the variable "HOSTNAME" is rather misleading :-)
06-14-2011 04:33 AM
Hostname is a bad var name but I don't see how it causes the problem... The agent is not running when I'm running the script and from root
su - wmsusr -c /wms/app/zabbix/check_zabbix.sh
Any ideas? THANKS!
06-14-2011 05:10 AM
> If I su to wmsusr and then run all is fine... Just when I'm calling from roots cron and trying to su to that user do I have an issue.
Why do you 'cron' this as 'root' if you then switch to the 'wmsusr'?
What happens if you 'cron' this task as the 'wmsuer' ?
06-14-2011 05:31 AM
> Right now only root user has cron and because of service guard they just want one crontab to maintain... Small IT group.
Regardless, would you humor us and try running as a crontask of 'wmsusr' (without the need to 'su')?
> Hostname is a bad var name but I don't see how it causes the problem
Of course not. I merely was pointing out that when you ask someone to look at your code, it always helps to have used *meaningful* variable names. You wouldn't show me an orange and tell me that the apple you have is rotten, would you?