Postgres backup query

Phil (OmnisList) phil at pgpotter.co.uk
Fri Aug 3 06:46:14 EDT 2018


Hi Will,

Just out of curiosity, why wouldn't you use pgAgent to do backups at set 
times of day?

On windows, you can run a batch file...
but not tried on Macs....
Presume you could run a shell script.

regards
Phil Potter
Based in Chester in the UK.

On 01/08/2018 12:46, will via omnisdev-en wrote:
> Hi List,
>
> How do you tell when pg_dump has finished a backup on PC?
>
> We want to issue a backup DB command and then copy the file off site via ftp.
>
> We use a bat file to trigger the backup control, but on Windows terminal sever 2012 this only begins the backup process and control is immediately returned to Omnis before it has finished. We could add code to check the size of the file on a timer and continue when it stops changing, but perhaps there is a better way?
>
> On Mac the $runapplescript equivalent waits for the backup to complete before coming back to Onnis, so perhaps there is a way to ask the batch file to wait until completion?
>
> For us an example Bat file would be something like:
>
>
> @echo off
> setlocal
> set PGPASSWORD=DBPassword
> "C:\Program Files\PostgreSQL\10\bin\pg_dump" -U username -p 5432 -h localhost -Fc -w SW8_SQLWORKS_COMPANYDB > "C:\SQLWorksBackupFolder\backup.sql"
>
>
> and we are running is with the following Omnis code (in 8.1.6):
>
>
>
> Get text block lvBackupScript
> Do pths.$:PathTempFolder Returns lvBatFilePath
> Calculate lvBatFilePath as con(lvBatFilePath,sys(9),'backuppg.bat')
> Do lvFileOps.$createfile(lvBatFilePath) Returns lvErrorCode
> If lvErrorCode<=1
> 	;  Must convert text into utf8 when writing or will put null characters into the file and stop it from working
> 	Do lvFileOps.$writefile(chartoutf8(lvBackupScript))
> 	Do lvFileOps.$closefile()
> 	Start program normal {[lvBatFilePath]}
> 	Launch program [lvBatFilePath] Returns lvErrorCode
> End If
>
>
>
>
>
>
>
> Best regards,
>
> Will
>
>
> Will Adkin / Software Development Manager
> will.adkin at lineal.co.uk <mailto:will.adkin at lineal.co.uk>
>
>   <mailto:will.adkin at lineal.co.uk>Lineal Software Solutions
> 01271 375999
> Unit 7, Riverside Court, Castle Street
> Barnstaple, Devon, EX31 1DR
> www.lineal.co.uk <http://www.lineal.co.uk/>
>
>
> _____________________________________________________________
> Manage your list subscriptions at http://lists.omnis-dev.com
> Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com
>



More information about the omnisdev-en mailing list