Zebra TC52 scheduled reboot

K
Kivlov
groupeleduff9458

Hello :)

I have about 200 Zebra TC52 terminals that I have to restart every morning. I have a constraint that prevents me from using a "simple" scheduled task, I have to reboot the terminals over a range of one hour, so that they don't all reboot at the same time. So I've set up a scheduled task that calls a JavaScript script:

function alea(min, max) {

    return Math.floor(Math.random() * (max - min + 1)) + min;

}

var entier = alea(60000, 3600000);

var info = Math.round(entier / 60000);

 

mobicontrol.message.createInfoDialog('redémarrage dans ' + info + ' minutes').show();

setTimeout(mobicontrol.device.reboot, entier);

Generally speaking, this script works and the terminals restart randomly between 08:00am and 09:00am. But for some reason, some terminals restart later... And sometimes up to several hours later! And yet, they're online, the SOTI agent is up and running, and when I look at the log I see that the task was launched at 08:00am with an execution time of several hours...

What could be causing this? I'm looking for a solution because restarting a terminal outside this range is a problem...

Thanks in advance!

a year ago
Android Scripting
ANSWERS
RC
Raymond Chan Diamond Contributor
a year ago

Have you checked if all the devices are configured to be in the same time-zone?

K
Kivlov
a year ago

Yes, the devices are configured to be in the same time-zone, GMT+1.

this morning, for example, this device received the script at the desired time (08:00am, device time as configured)), and indicates that it will restart in 26 minutes (calculated via the script). 49 minutes later, it still hasn't restarted.

Can the dialog maybe block that reboot then (even then it's strange that some work and some doesn't)?
So maybe put the dismiss of the dialog into the script as well like in the help:

var dialogId = mobicontrol.message.createInfoDialog('The dialog will be dismissed in 1 second.').show();
setTimeout(delayFunction, 1000);

function delayFunction() {
    mobicontrol.message.dismiss(dialogId);
mobicontrol.device.reboot; }
K
Kivlov
a year ago

Hello,

that's something I hadn't thought of at all!

I'm going to try disabling the dialog box to check its behavior.

Thanks a lot!

In addition what Raymond already mentioned (for good reason), check if the devices have been unlocked minimum once between last reboot and script being executed. My experience is that otherwise it can be that the script will only be executed when the device gets unlocked.

K
Kivlov
a year ago

Hello,

yes the terminal is unlocked (no lock configured) and our internal software has started. the same configuration on other terminals is not a problem (I have terminals that restarted as expected this morning with a similar configuration).

ZC
Zafer Cigdem
a year ago

Hi Kivlov,

Even if the device will be offline after they receive this command, they should run reboot. What you can verify on these devices:

- You can send out any script and monitor whether it get actions directly (as maybe even if you can see the the script is received on MobiControl Webconsole, maybe this may not delivered to device side at the same time, it is no a must to use reboot you can even use showmessage script just to monitor whether as soon as you send a script you can see the message on the same time).

I would also add to create a text message on your JS script to record the message received time before showing the message to the customer and then do the same just before the reboot action on 2 different .txt files on these devices folder path. So it would give us more information to troubleshooting when needed. I hope it helps, if you need any help on JS, feel free to let us know :)

Zafer

K
Kivlov
a year ago

thank you for your reply.


indeed, i'll try to monitor how the terminal receives the script: first i'll try Rafael's solution by simply disabling the dialog box (i'm not obliged to display it) to see if the behavior changes.


I've checked a number of terminals and they're all correctly configured with GMT+1, in the same time zone and automatically updated via the NTP server.

ZC
Zafer Cigdem
a year ago

Sure sounds great. I've also suspect that the dialog box may cause an issue and I've already test it out by changing the value on your timeouts. For my AE Samsung device, even if I have the dialog box on the screen reboot works well.

But for sure, it's always better to do double/triple check :)

function alea(min, max) {
    return Math.floor(Math.random() * (max - min + 1)) + min;
}
 

var entier = alea(60000, 100000);
var info = Math.round(entier / 60000);
 
mobicontrol.message.createInfoDialog('redémarrage dans ' + info + ' minutes').show();
setTimeout(mobicontrol.device.reboot, entier);

K
Kivlov
a year ago

Hello,

I've deactivated the dialog box, but I still get the same phenomenon on a few devices at random.

I've activated the Zebra RX Logger tool on a few terminals, so with a bit of luck I'll be able to see the problem on them, and it saves doing it in JS.

I'll let you know if I manage to get any logs!

ZC
Zafer Cigdem
a year ago

Best of luck,

As I mentioned on above, if you can create a text message on device's path via JS also before the reboot function, and also after the reboot function that may give some more clue as well. 

Zafer

S
SMMOD@SOTI
a year ago

Hi Kivlov,

I hope the suggestions provided by Raymond, Zafer, and Rafael have helped you answer your query. Please inform us if you require further assistance. 

Additionally, if any response has helped address your inquiry, we kindly request you to mark it as "is solution" so that others may also benefit from this information.

Thank you, Raymond, Zafer, and Rafael for your valuable suggestions.

Thank you for choosing SOTI.