Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X
HI,
I would like to know how I can restart all industrial things after Tomcat reboot.
I made service and it looks like that:
if (itemNumber <= (me.foundThings.rows.length - 1)) {
var foundItem = me.foundThings.rows[itemNumber].Name;
Things[me.foundThings.rows[itemNumber].Name].RestartThing();
for (var x = 0; x < 3000; x++) {
//sleeper
}
me.foundThings.rows[itemNumber].Status = 'Done';
me.foundThings.rows[itemNumber].LastConnection = new Date();
me.RestartConnection({
serverName: serverName /* THINGNAME */,
NameThing: me.foundThings.rows[itemNumber].Name /* STRING */
});
result = itemNumber + 1;
} else {
result = 10000000;
}
RestartConnection service was created to re-append the Kepware server name to the Industrial Thing properties.
My problem is that what I created works very randomly. Of the 3, Industrial Things restarts 1 or 2 or does not add the server name to Industrial Thing.
How can I create a tool to restart all Industrial Things to avoid having to do it manually?
Thank you,
Jan
Why would you want to restart the things when tomcat was just restarted? Then all things were already restarted.
On a side note: don't do the assignment to me.foundThings this way. Create a local variable for foundThings. do the loop assignments there. After the loop, assign me.foundThings to the local variable.
Hi
Thank you for answer in middle of your night.
because in TWX 8.4 Industrial Things lose connection with Kepserwer or do not send the entire set of properties that are connected to Kepserwer.
They are waiting for the first change and I have such surprises that properties 1 is refreshed and properties 2 and 3 are saved as null.
After restartThing it works as it should
No worries, it's not the middle of the night where I am
I probably can't help with the resolution of this, but it might be helpful if you post some of your environment. Thingworx version, Kepware version, used protocols, etc. Is it really 8.4? Because this is out of support for many years,
yesterday I found solution for it.
Yes its 8.4 we are in middle of process with upgrade to TWX 9.3 but it takes time as always.
I will make note below how I resolved my problem a bit later.
Thank you
Jan
Great. Please also verify this on 9.3 - there were a lot of architectural changes and maybe you don't need the restart anymore at all.
I saw it. I hope after upgrade my life will be much easier hah