0

Strangely, on one of our server, pg_dumpall, when executed by cron, only dumps "postgres" database, instead of all databases.

But when executing it from command line, it works.

I suspect it must be due to some environment variable, but I don't know where it may come from.

Of course I can provide more information if needed, but I don't know what to give more, because I don't exactly know the source of this strange problem ?

db_ch
  • 648
  • 5
  • 14
  • 21

1 Answers1

1

Clearly, the cron script is executing either

  1. as a different user.
  2. with different arguments.
  3. running a different program altogether.

If you're on Ubuntu or Debian make sure you're using the one in your path directly, you may have one in /usr/lib and one in /usr/bin

Evan Carroll
  • 2,373
  • 10
  • 34
  • 53
  • Sorry to come back 2 yeas later but it happens again... Strangely : 1. It is the same user (postgres) 2. Exact same arguments (copy and paste from script executed by crontab) 3. The same program as I directly call "/usr/bin/pg_dumpall" – db_ch Feb 19 '19 at 17:13