Reputation: 2257
I am creating a program that runs as a service and makes database backups (using pg_dump.exe) at certain points during the day. The service runs fine normally, but fails to make backups when you try to put them in a network drive. If I stop the service and run the executable manually, it works fine.
Here is an example of what the program writes to the command line in order to run the backups:
"E:\Program Files\PostgreSQL\9.3\bin\pg_dump.exe" -Ft -f "\\<computer name>\Backups\DBBackup" -U postgres -h <computer name> -p 5432 <Database Name>
I have tried using the \\<computer name>\<backup directory>\
syntax for the location of the network drive, and I have also tried using the drive's letter on my computer (S:\<backup directory>
). Both of these options work when the program is run manually, but neither work when it is run as a service. I tried looking for errors in the system event viewer log but found nothing relevant.
So to summarize, the program will make backups successfully when run as a service, but not if it tries to write them to a network drive. When the program is run manually (not as a service) it writes successfully to network drives.
Anybody know why this is happening?
Upvotes: -1
Views: 92
Reputation: 2257
I fixed the problem by having the service log on using an account (specifically, the network service account)
Upvotes: 0