Hope you'll get some idea from this workaround. Have you consider using File Sync Rule?
1. Create a rule that synchronizes a dummy file between server and device.
2. Select "Sync files when Device Connects"
3. Click on "advanced" > Scripts
4. Then put the script you want to execute when device gets online
The only drawback of this is that when device gets offline because of no internet connection, and later on it gets reconnected, the script will automatically execute even though the device didn't reboot.