As the subject line says, I can't get this script to run correctly from cron.

 My cron entry (in a file in /etc/cron.d):

======================================

# Run the 30-minly job

SHELL=/bin/bash

PATH=/sbin:/bin/:/usr/sbin:/usr/bin:/root

MAILTO=ROOT

*/30 * * * * root /root/getlist

======================================


/root/getlist   perms a+r, a+x, u+w:

=====================================

#!/bin/bash

z4=`ansible mainmachine -m shell -a "psql -t -Upiquah -c \"subnet.ipaddress || '##' || subnet.netmask from subnet  order by subnet.ipaddress asc;\"" 2>&1  | grep '^ [0-9]'`

echo $z4

=====================================

from which, if you run this "by hand", you'll get some output that looks like this:

19.20.21.22##255.255.255.255 23.24.25.26##255.255.255.255 130.140.150.160##255.255.255.254

... and so forth.

BUT, if executed from cron, $z4 will be empty.


What do I need to do to in the cron.d file to make this work well?



--
You received this message because you are subscribed to the Google Groups "Ansible 
Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/b11a6bc2-2938-2bdd-db40-b91ec77e7299%40parsetree.com.

Reply via email to