Hello,
I'm trying to schedule the sending of an e-mail using cron with mailx (or nail). When I execute the script manually, everything works properly, but when I have cron call it, the output from mailx includes "Error initializing NSS: Security library: bad database."
I believe there is some kind of user/permissions issue, but I can't figure it out.
First, the crontab entry:
Code:
40 11 * * * MyNonRootUser /full/path/to/myscript.sh
And the command issued within myscript.sh:
Code:
echo "message body" | nail -v -s "Subject" -S smtp-use-starttls -S s mtp=smtp://smtp.gmail.com:587 -S smtp-auth=login -S smtp-auth-user=myemail@gmail.com -S smtp-auth-password=mypassword -S from="myemail@gmail.com" -S nss-config-dir=/home/MyNonRootUser/.mozilla/firefox/xxxxxx.default -S ssl-verify=ignore myemail@gmail.com 2>&1
And the verbose output from mailx:
Code:
Resolving host smtp.gmail.com . . . done.
Connecting to 74.125.113.109:587 . . . connected.
220 mx.google.com ESMTP
>>> EHLO
250-mx.google.com at your service,
250-SIZE 35882577
250-8BITMIME
250-STARTTLS
250 ENHANCEDSTATUSCODES
>>> STARTTLS
220 2.0.0 Ready to start TLS
Error initializing NSS: Security library: bad database.
. . . message not sent.
I've also got it working using
Code:
su MyNonRootUser -c myscript.sh
but this isn't appropriate for cron, as su asks for a password.
Any ideas?
Thanks!
-Kerry