Hehe
Oki thanks
IT2Be wrote:Glad you saw it! Did not want to correct you again :lol:
IT2Be wrote:The only thing you need to know/realize that this 'eats' one client license!
axterics wrote:IT2Be wrote:The only thing you need to know/realize that this 'eats' one client license!
The licence is eaten always? Only when the headless client perform the cronjob or always when the headless client is started (in a production server = always)?
Pierre-andre wrote:At the moment, the server is working on Windows. But this method have to work with Linux and Mac OS/X.
In first, I wanted to create a stored procedure in PostgreSQL and executed it from servoy. But Postres don't allow to create Procedure, only function. Unfortunately I can't execute a REINDEX, PG_DUMP OR VACUUM command on database in function because "REINDEX cannot be executed inside a transaction block."
http://www.postgresql.org/docs/8.2/inte ... index.html
So I choosed to use cronjob. I created a Startup script :var jobname = "backup"
var cronTimings = "* 00 22 * * ?"
var startDate = new Date()
var endDate = new Date(startDate.getFullYear()+50,startDate.getMonth(),startDate.getDate())
var args = new Array(directory_postgres,directory_for_backup)
plugins.scheduler.addCronJob(jobname, cronTimings, globals.Backup_DB,startDate,endDate,args)
The method backup:var directory_postgres = arguments[0]
var directory_for_backup= arguments[1]
//Returns the name of the operating system
var osname = application.getOSName();
if(osname.indexOf("Windows",0)>-1){
var file = plugins.file.convertToJSFile(directory_postgres +"/vacuumdb.exe")
if(file.exists())
application.executeProgram(directory_postgres +"/vacuumdb.exe","-h","localhost","-p","5432","-U","postgres","-d","sopavet")
var file = plugins.file.convertToJSFile(directory_postgres +"/reindexdb.exe")
if(file.exists())
application.executeProgram(directory_postgres +"/reindexdb.exe","-h","localhost","-p","5432","-U","postgres","-d","sopavet"
var file = plugins.file.convertToJSFile(directory_postgres +"/pg_dump.exe")
if(file.exists())
application.executeProgram(directory_postgres +"/pg_dump.exe","-i","-h","localhost","-p","5432","-U","postgres","-F","t","-f","\""directory_for_backup+"/database_save.backup\"","sopavet"
}
I have to add security rules with postgres's user and complete this method for Linux and Mac OS/X.
It's work fine on Windows XP with Postgres 8.1, but I didn't know that batch process use one client license .So I have to find another way to backup my database.
Jan Aleman wrote:Have you considered using pgAgent? Sounds like less work to me.
http://www.postgresonline.com/journal/a ... ckups.html
Users browsing this forum: No registered users and 17 guests