Run a Process once when BS is Published

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
gernotlg
Posts: 80
Joined: Fri Aug 27, 2021 1:24 am

Run a Process once when BS is Published

Post by gernotlg »

Is there a way to start a process as soon as a new BS is published ?

eg. If I had a process called InitBS

System running happily.... BS get published .... InitBS gets executed... system keeps running happily, and initBS never runs again unless a new BS is Published.

I have a workaround using the Schedular, where I read the most recent VERSIONSTR ...

Code: Select all

SELECT VERSIONSTR FROM basdb.domainversions where DNAME = 'mybsname' order by VERSIONSTR DESC Limit 1;
then I compare that value with the one I previously saved in SystemSettings ... and if it's different then I can call InitBS

But of course, it has to execute repeatedly, to check the version of my BS.

Wondering if there's a better way to run a process once at the start when a new BS is published.

Note: This needs to be a system process that I run, so I can't use the execute process when VP is loaded/initialized

I have also tried Database scripts, but it clearly only executes when BS is published '...for the first time' like it says.

Thanks
V8.8 / Windows / MySQL
hpl123
Posts: 2599
Joined: Fri Feb 01, 2013 1:13 pm
Location: Scandinavia

Re: Run a Process once when BS is Published

Post by hpl123 »

Well, there exists no "native" way of doing this but what you are doing should work and doesn´t cause any noticeable load or tax on the system (i.e the rule checking current version VS last checked current version is so minor etc. it doesn´t matter if it run repeatedly). The only tip I have is, there is a Aware function you can use in rules that gets the current version and you can use that to check against another attribute holding the "last" current version. Look here: https://www.awareim.com/dokuwiki/doku.p ... sv_version

An addition to this is, it is maybe better to just check version via the function above 1 time and set a yes/no flag with a value and then in your process that runs repeatedly, check that flag instead of running the Aware function every time which theoretically would mean even less load/tax when checking repeatedly.
Henrik (V8 Developer Ed. - Windows)
gernotlg
Posts: 80
Joined: Fri Aug 27, 2021 1:24 am

Re: Run a Process once when BS is Published

Post by gernotlg »

ah sweet. Thanks. that'll save a database query every time.
V8.8 / Windows / MySQL
Post Reply