Batch processors

Questions, tips and tricks and techniques for scripting in Servoy

Batch processors

Postby Pierre-andre » Wed Aug 29, 2007 2:37 pm

Hi,

I would like to create a batch processor to backup my database everyday at 22:00.

I use the Scheduler plugin with this code:

Code: Select all
plugins.scheduler.addCronJob(jobname, "* 00 22 * * ?", globals.Backup_DB,startDate,endDate,args)


When I strat this method from client, it's work well but when I shutdown the client, this process is remove automatically.

How can I make a batch process which call a global method every day at 22:00 when all clients are close.

Thanks
Pierre-andre
 
Posts: 55
Joined: Mon Aug 20, 2007 9:31 am

Postby IT2Be » Wed Aug 29, 2007 2:45 pm

You can start a batch processor on the Servoy server. This is a (headless) client running on that machine. See documentation and web admin pages.

BTW why don't you perform a backup through the db tools of your database?
Marcel J.G. Trapman (IT2BE)
SAN partner - Freelance Java and Servoy
Servoy Components - IT2BE Plug-ins and Beans for Servoy
ServoyForge - Open Source Components for Servoy
User avatar
IT2Be
Servoy Expert
 
Posts: 4766
Joined: Tue Oct 14, 2003 7:09 pm
Location: Germany

Postby Pierre-andre » Wed Aug 29, 2007 2:51 pm

Because I've a form on Servoy where I change easily the frequency of backup.

With cronTimings I think it easy and I don't know postgres rather well to do that with tool.
Pierre-andre
 
Posts: 55
Joined: Mon Aug 20, 2007 9:31 am

Postby IT2Be » Wed Aug 29, 2007 2:55 pm

OK, I understand.

Well in that case you could use the batch processor.
Marcel J.G. Trapman (IT2BE)
SAN partner - Freelance Java and Servoy
Servoy Components - IT2BE Plug-ins and Beans for Servoy
ServoyForge - Open Source Components for Servoy
User avatar
IT2Be
Servoy Expert
 
Posts: 4766
Joined: Tue Oct 14, 2003 7:09 pm
Location: Germany

Postby Pierre-andre » Wed Aug 29, 2007 4:03 pm

Thanks It's work fine :)
Pierre-andre
 
Posts: 55
Joined: Mon Aug 20, 2007 9:31 am

Postby IT2Be » Wed Aug 29, 2007 4:06 pm

The only thing you need to know/realize that this 'eats' one client license!
Marcel J.G. Trapman (IT2BE)
SAN partner - Freelance Java and Servoy
Servoy Components - IT2BE Plug-ins and Beans for Servoy
ServoyForge - Open Source Components for Servoy
User avatar
IT2Be
Servoy Expert
 
Posts: 4766
Joined: Tue Oct 14, 2003 7:09 pm
Location: Germany

Postby ROCLASI » Wed Aug 29, 2007 4:23 pm

Hi Pierre-andre,

Why use a Servoy cronjob to schedule a database backup when you can do it all on the server itself?
I assume you use pg_dump/pg_dumpall for the backup. Depending on the OS you are using you can setup a server cronjob to trigger this.
What OS are you using ?
Robert Ivens
SAN Developer / Servoy Valued Professional / Servoy Certified Developer

ROCLASI Software Solutions / JBS Group, Partner
Mastodon: @roclasi
--
ServoyForge - Building Open Source Software.
PostgreSQL - The world's most advanced open source database.
User avatar
ROCLASI
Servoy Expert
 
Posts: 5438
Joined: Thu Oct 02, 2003 9:49 am
Location: Netherlands/Belgium

Postby IT2Be » Wed Aug 29, 2007 4:28 pm

Hi Robert, I asked almost the same question with the following reply
Because I've a form on Servoy where I change easily the frequency of backup.

With cronTimings I think it easy and I don't know postgres rather well to do that with tool.
Marcel J.G. Trapman (IT2BE)
SAN partner - Freelance Java and Servoy
Servoy Components - IT2BE Plug-ins and Beans for Servoy
ServoyForge - Open Source Components for Servoy
User avatar
IT2Be
Servoy Expert
 
Posts: 4766
Joined: Tue Oct 14, 2003 7:09 pm
Location: Germany

Postby ROCLASI » Wed Aug 29, 2007 4:36 pm

IT2Be wrote:Hi Robert, I asked almost the same question with the following reply
Because I've a form on Servoy where I change easily the frequency of backup.

With cronTimings I think it easy and I don't know postgres rather well to do that with tool.

Ah!
But how do you access the form in a batchprocessor? ;)
An option would be to make it data(base) driven but that does mean you have to let it remove the current (Servoy) cronjob and load the new one.
I think a cronjob on the server is easier to change.
Robert Ivens
SAN Developer / Servoy Valued Professional / Servoy Certified Developer

ROCLASI Software Solutions / JBS Group, Partner
Mastodon: @roclasi
--
ServoyForge - Building Open Source Software.
PostgreSQL - The world's most advanced open source database.
User avatar
ROCLASI
Servoy Expert
 
Posts: 5438
Joined: Thu Oct 02, 2003 9:49 am
Location: Netherlands/Belgium

Postby IT2Be » Wed Aug 29, 2007 4:44 pm

An option would be to make it data(base) driven but that does mean you have to let it remove the current (Servoy) cronjob and load the new one.
Excactly what I thought of. Starting and stopping the cronjob is very easy because you already know the name.

I don't really agree it is necessarily easier to create a cronjob on the server. that depends on rights that you want/can give to the user that is allowed to change these settings.
I do agree in general that it would be easier/more flexible/more controllable to let the appropriate db tools do the job.
Marcel J.G. Trapman (IT2BE)
SAN partner - Freelance Java and Servoy
Servoy Components - IT2BE Plug-ins and Beans for Servoy
ServoyForge - Open Source Components for Servoy
User avatar
IT2Be
Servoy Expert
 
Posts: 4766
Joined: Tue Oct 14, 2003 7:09 pm
Location: Germany

Postby pbakker » Wed Aug 29, 2007 4:45 pm

But how do you access the form in a batchprocessor?


A batchprocessor is a full client, so you should have no problem whatsoever accessing the form...
pbakker
 
Posts: 2822
Joined: Wed Oct 01, 2003 8:12 pm
Location: Amsterdam, the Netherlands

Postby ROCLASI » Wed Aug 29, 2007 4:46 pm

pbakker wrote:
But how do you access the form in a batchprocessor?


A batchprocessor is a full client, so you should have no problem whatsoever accessing the form...

Erm...it's a headless client. How would you want to access the form as a human? :)
Robert Ivens
SAN Developer / Servoy Valued Professional / Servoy Certified Developer

ROCLASI Software Solutions / JBS Group, Partner
Mastodon: @roclasi
--
ServoyForge - Building Open Source Software.
PostgreSQL - The world's most advanced open source database.
User avatar
ROCLASI
Servoy Expert
 
Posts: 5438
Joined: Thu Oct 02, 2003 9:49 am
Location: Netherlands/Belgium

Postby pbakker » Wed Aug 29, 2007 4:51 pm

Ehum... You just use a solution as batchprocessor... you can also open the same solution as a client and alter the settings for the schedule by going to the form.

As I understand it, he wants to have scheduled processes and through a GUI he created be able to edit their schedule.

Paul
pbakker
 
Posts: 2822
Joined: Wed Oct 01, 2003 8:12 pm
Location: Amsterdam, the Netherlands

Postby IT2Be » Wed Aug 29, 2007 4:52 pm

- create a table with preferences
- create a form for the user to access the table

That is how I created settings for a batch processor.
Marcel J.G. Trapman (IT2BE)
SAN partner - Freelance Java and Servoy
Servoy Components - IT2BE Plug-ins and Beans for Servoy
ServoyForge - Open Source Components for Servoy
User avatar
IT2Be
Servoy Expert
 
Posts: 4766
Joined: Tue Oct 14, 2003 7:09 pm
Location: Germany

Postby ROCLASI » Wed Aug 29, 2007 5:08 pm

pbakker wrote:Ehum... You just use a solution as batchprocessor... you can also open the same solution as a client and alter the settings for the schedule by going to the form.

As I understand it, he wants to have scheduled processes and through a GUI he created be able to edit their schedule.

Paul

I stand corrected.
Robert Ivens
SAN Developer / Servoy Valued Professional / Servoy Certified Developer

ROCLASI Software Solutions / JBS Group, Partner
Mastodon: @roclasi
--
ServoyForge - Building Open Source Software.
PostgreSQL - The world's most advanced open source database.
User avatar
ROCLASI
Servoy Expert
 
Posts: 5438
Joined: Thu Oct 02, 2003 9:49 am
Location: Netherlands/Belgium

Next

Return to Methods

Who is online

Users browsing this forum: No registered users and 14 guests