For my dissertation I'm running the same cronjob on around 300 machines, which is:
10,25,40,55 * * * * /path/to/db_script.sh 1>/dev/null
This script gets some values from the system (whether there is someone logged on), and then runs an INSERT statement on a remote PostgreSQL database. In my script, I specify the location of the .pgpass file for authentication, which is in the same folder as this script. This folder is mounted on (I believe) an NFS file system mounted with AMD.
Now, mostly the cronjob runs fine, but every so often I get a couple of errors that say:
psql: FATAL: no PostgreSQL user name specified in startup packet
FATAL: no PostgreSQL user name specified in startup packet
Could this be due to the large number of machines trying to access the .pgpass file at the same time? Can S.O. suggest a way to avoid these errors? I'm currently only getting 2 or 3 machines with the error (out of approximately 200 at the moment), and it doesn't happen every time the job runs. But, it would be nice to avoid it entirely!
sleep
ing for a small random number of seconds at the beginning of the script? It's not very proper, but might alleviate the problem if you think it's a concurrent access matter. – Ulrich Schwarz Jan 7 '12 at 7:36