# Download schedule

**URL:** <https://forum.genieacs.com/t/download-schedule/6316>\
**Category:** Uncategorized\
**Created:** [December 18, 2024, 7:49am UTC](https://forum.genieacs.com/t/download-schedule/6316 "2024-12-18T07:49:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kmlsmv1](https://avatars.discourse-cdn.com/v4/letter/k/f1d935/32.png) [@kmlsmv1](https://forum.genieacs.com/u/kmlsmv1)\
**Post date:** [December 18, 2024, 7:49am UTC](https://forum.genieacs.com/t/download-schedule/6316/1 "2024-12-18T07:49:22Z")

</div>

Hello,  
i am trying to do schedule firmware upgrade but setting time not working,

const now = Date.now();  
const softwareVersion = declare(“Device.DeviceInfo.SoftwareVersion”, { value: now }).value[0];  
const productClass = declare(“DeviceID.ProductClass”, { value: now }).value[0];

commit();

const futureTime = randomFutureTime(); // Random future time is defined here  
const readableNow = new Date(now).toString();  
const readableFutureTime = new Date(futureTime).toString();

// Logging  
log(`Script: now - Current Timestamp: ${now}`);  
log(`Script: now - Random Future Timestamp: ${futureTime}`);  
log(`Script: now - Readable Current Time: ${readableNow}`);  
log(`Script: now - Readable Future Time: ${readableFutureTime}`);

if (softwareVersion !== “XXXXXX v2.1 b366”) {  
switch (productClass) {  
case “XXXXXXXXXX”:  
log(“XXXXXXXXXX - Upgrading to XXXXX v2.1 b366 firmware”);  
configureFirmwareUpgrade(“file.bin”);  
break;

```
}

```

}

function configureFirmwareUpgrade(fileName) {  
declare(“Downloads.[FileType:1 Firmware Upgrade Image]”, { path: 1 }, { path: 1 });  
declare(“Downloads.[FileType:1 Firmware Upgrade Image].FileName”, { value: 1 }, { value: fileName });  
declare(“Downloads.[FileType:1 Firmware Upgrade Image].Download”, { value: 1 }, { value: futureTime });  
}

function randomFutureTime() {  
const now = Date.now(); // Current timestamp  
const minMinutes = 1; // Minimum 1 minute  
const maxMinutes = 5; // Maximum 5 minutes  
const randomMinutes = Math.floor(Math.random() \* (maxMinutes - minMinutes + 1)) + minMinutes; // Random minutes  
const randomMillis = randomMinutes \* 60 \* 1000; // Convert minutes to milliseconds  
return now + randomMillis; // Add random duration to current time  
}

---

<div class="post-metadata">

**Author:** ![akcoder](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.genieacs.com/akcoder/32/11_2.png) [@akcoder](https://forum.genieacs.com/u/akcoder)\
**Post date:** [December 18, 2024, 6:02pm UTC](https://forum.genieacs.com/t/download-schedule/6316/2 "2024-12-18T18:02:09Z")

</div>

You need to use a scheduled preset to kickoff the provision. This option will run for two hours (7200 seconds) starting at 11 am GMT. `7200 0 11 * * *`

---

<div class="post-metadata">

**Author:** ![kmlsmv1](https://avatars.discourse-cdn.com/v4/letter/k/f1d935/32.png) [@kmlsmv1](https://forum.genieacs.com/u/kmlsmv1)\
**Post date:** [December 18, 2024, 6:26pm UTC](https://forum.genieacs.com/t/download-schedule/6316/3 "2024-12-18T18:26:18Z")

</div>

I know that, but I don’t want devices sending informs at the same time to simultaneously download and cause reboots.

(I have interconnected switches, and I don’t want the firmware update process to be interrupted.)
