Skip to main content

server.restart()

Manually restarts the imp or its agent

Availability

Device + Agent

Returns

Nothing — does not return

Description

Following a restart request trapped by server.onshutdown(), the device or agent should call server.restart() when the server-requested restart should actually take place, ie. when the device or agent has carried out any housekeeping or critical tasks it needs to perform before restarting.

The method can also be used to trigger a manual restart of either device or agent at any time. server.restart() doesn't reboot the imp, instead it restarts impOS™’s Squirrel virtual machine, which implicitly causes impOS to action the installation of staged Squirrel and/or impOS updates.

This call does not return: the agent or device Squirrel restarts from scratch which may cause an impOS update to be installed and/or new Squirrel application code to be loaded and run.

Example Code

This example demonstrates how to save important data before agents and devices restart.