I have a python script which I am executing through a shell script for some reason(not important here). In my script I am basically fetching some url content and sending emails to a specific people.I have added the security keychain for that using something like this security add-generic-password -s SMTP -a USERID -w PASSWORD
When run from the command line I was prompted to give access to the keychain item for the 'security' command. After granting access via Keychain Access I can run the script and it no longer prompts for the retrieval of the password and it does send me emails.
But Cron Job and Launchd doesn't give me the desired output. After googling a bit I found that cronjob doesn't have access to keychains and I need to give the password while running as a cron job if I want it to serve the purpose. I am not very sure about launchd if it has access to keychains or not. It seems to have worked for the below person for Ruby. https://lists.macosforge.org/pipermail/launchd-dev/2008-August/000363.html
I have same problem as that guy did. When invoked from launchctl I do not get any emails. However if I hardcode the passwords in my code I do get the emails at the specified time. So I am assuming that my problem here is the keychains that launchd is not able to read. Is there a way to grant access of keychains to the launchd? I have my com.Query.plist file in the $HOME/Library/LaunchAgents directory.
false
to use a script that added to my keychain. – Implement