Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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!

share|improve this question
2  
If it belongs on U&L just ask for it to be moved; you don't need to manually repost things –  Michael Mrozek Jan 6 '12 at 18:22
    
NFS issues was my first thought: staggering the cronjobs might be tricky as I'd probably have to go through and change them individually or something. Copying the .pgpass file might work, although my home directory is also network mounted (but on AFS), and security may become an issue. I'll have a hunt on the other stack- sites and see if I can come up with something... –  shearn89 Jan 6 '12 at 23:39
    
@shearn89: how about sleeping 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
    
@UlrichSchwarz that may well be the solution! I'll give it a go and see what happens. –  shearn89 Jan 7 '12 at 14:49
add comment

migrated from dba.stackexchange.com Jan 7 '12 at 0:03

This question came from our site for database professionals who wish to improve their database skills and learn from others in the community.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.