Hello All,
I am running the below script.when i am running from shell or terminal its running fine but running using cron its not working.
################################
b36376 27 % cat make_nis_account_ankit.sh
#!/bin/ksh
SSH="/_TOOLS_/dist/openssh-3.7.1p2/sparc-sun-solaris2.9/bin/ssh"
ldap_command="ldapsearch -LLL \"motguid=b36376\" -h fsl-ids.freescale.net -x -Z -D \"cn=idcweb_ldap,ou=application\ users,ou=applications,ou=intranet,dc=motorola,dc=com\" -w \'#Idcldap\' -b \"ou=people,ou=intranet,dc=motorola,dc=com\""
su - pankajd -c "$SSH db0003 $ldap_command" > /tmp/ankit_testing| 2>/dev/null
b36376 28 %
################################
Can someone let me know what is the issue when running using cron.
Regards
Ankit
Cron doesn't know where your executables are probably, in this case ldapsearch i guess.
Add the path where ldapsearch is or use absolute path to ldapsearch tool.
First couple of lines of your script, change it to see what going on.
#!/bin/ksh -x
exec 2>>/path/to/log.log
rest of the code
Also please use code tags while posting code.
Hi,
Now i have given full path to ladapsearch but still getting the below error while running from cron.
########################
[root@vmtest15 tmp]# cat user_check_ankit.log
+ ldap_command=$'/usr/bin/ldapsearch -LLL "motguid=b36376" -h fsl-ids.freescale.net -x -Z -D "cn=idcweb_ldap,ou=application\\ users,ou=applications,ou=intranet,dc=motorola,dc=com" -w \\\'#Idcldap\\\' -b "ou=people,ou=intranet,dc=motorola,dc=com"'
+ su - pankajd -c $'ssh db0003 /usr/bin/ldapsearch -LLL "motguid=b36376" -h fsl-ids.freescale.net -x -Z -D "cn=idcweb_ldap,ou=application\\ users,ou=applications,ou=intranet,dc=motorola,dc=com" -w \\\'#Idcldap\\\' -b "ou=people,ou=intranet,dc=motorola,dc=com"'
+ 1> /tmp/ankit_testing
Unmatched '.
[root@vmtest15 tmp]#
#########################
REgards
Ankit