FileSync Script launch .js file

Hi,

I have FileSync Rule (AE Managed Device) that is uploading multiple files to the devices. One of the file is .js and I would like to execute it if if any of the files changes but I don't know how.

Only option that comes to my mind is to copy whole script to the FileSync rule script box but I would rather not as it could change in the future and it could lead to mess.

The script itself is not created as (function(root).. , it begins simply with "try {.." so I'm not sure if I could load it with "require" and if yes how to launch it as whole script/file

I will be glad for any suggestions

2 years ago
Android Scripting
ANSWERS
L
LCRMOD@SOTI
2 years ago

Hi MiKe,

Thank you for contacting SOTI Pulse. 

Would it be possible to know what other methods you have tested to accomplish this?

A workaround for us to test would be to create a separate FileSync Rule with only the Script which would allow it to be changed as needed without affecting the other files in the future.

Another area that can be tested would be to specify a script to be run on the server before file synchronization starts or specify a script to be run on the device either before or after file synchronization which can be found on the File Sync Scripts page. 

For information on device-side scripts, see the samples scripts and the using script commands.

Once we have a better understanding of what you are trying to achieve, have tested and the outcomes, we will be able to look into it further. 

I look forward to hearing from you. 

Regards, 
Technical Support | SOTI Inc. |1.905.624.9828 | Log a Case Webform | SOTI.net | Facebook | LinkedIn | Twitter

SOTI SYNC

See you in Munich. 

M
MiKe
2 years ago

Hello,

I'll try to make simple example.

I've created helloworld.js (to display "Hello World" message) and I want to File Sync it to the devices so I can autolaunch it using Lockdown item "script://sdcard/helloworld.js" but I also want to launch it immediately after succesfull File Sync event without nasty workarounds (i.e. disabling and enabling Lockdown and definitely not by restarting the device).

The only option I'm aware of (and that I must use now) is to copy whole script to the FileSync Rule script part. This has major drawback that if I need to change the script I have to do it on two places.

So I'm looking for the solution how to start /sdcard/helloworld.js file by some command in FileSync Rule script.  

L
LCRMOD@SOTI
2 years ago

Good afternoon MiKe,

Thank you for the example above.

Can you please outline the business case as to why this should be done this way (what are you trying to achieve that could not be done with the other workarounds you've specified)? If you wish to discuss these aspects privately, please let me know and we can proceed to direct message you accordingly. 

Please outline the version of SOTI MobiControl that you are currently on and if your instance if on Cloud or on Premise. 

Once we have a better understanding of what you are trying to achieve, have tested and the outcomes, we will be able to look into it further. 

I look forward to hearing from you. 

Regards, 
Technical Support | SOTI Inc. |1.905.624.9828 | Log a Case Webform | SOTI.net | Facebook | LinkedIn | Twitter

SOTI SYNC

See you in Munich. 

M
MiKe
2 years ago

Hi,

15.5 on-premise but it could be the same for older and newer versions either cloud or on-premise.

There are numerous cases - mostly when you want to change or check something based on dynamic conditions and act on in.

In this case the script reads ICCID and checks if it's the same as before or someone changed the SIM card. If SIM card was changed it looks to the database provided with FileSync and changes APN parameters accordingly. So it's run after each reboot using Lockdown. but you also want to run it inmediately after FS change files event (either because it's the first time or because either the script or the database has changed and Lockdown is already running)

L
LCRMOD@SOTI
2 years ago

Good afternoon MiKe

We will be doing further testing with our level 4 agents and once we have further information, we will update this case with the next steps accordingly. 

Thank you for contacting SOTI Pulse, have a great day.

Regards, 
Technical Support | SOTI Inc. |1.905.624.9828 | Log a Case Webform | SOTI.net | Facebook | LinkedIn | Twitter

SOTI SYNC

See you in Munich. 

L
LCRMOD@SOTI
2 years ago

Good afternoon MiKe,

Apologies for the delay, I hope this finds you well.

Have you considered executing the script every time the device connects to the server, that way as soon as it connects to SOTI MobiControl, the script is executed? 

You could then send a post-install script with the file sync rule to restart the agent, when the device reconnects, the script will be executed, which would then ensure that the script is executed after every file sync is completed.

Thank you for contacting SOTI Pulse, have a great day.

Regards, 
Technical Support | SOTI Inc. |1.905.624.9828 | Log a Case Webform | SOTI.net | Facebook | LinkedIn | Twitter

SOTI SYNC

See you in Munich.