# script works in terminal windwo but not in scheduler

**URL:** <https://forum.mikrotik.com/t/script-works-in-terminal-windwo-but-not-in-scheduler/143709>\
**Category:** Scripting\
**Created:** [October 11, 2020, 8:46pm UTC](https://forum.mikrotik.com/t/script-works-in-terminal-windwo-but-not-in-scheduler/143709 "2020-10-11T20:46:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![brg3466](https://forum.mikrotik.com/user_avatar/forum.mikrotik.com/brg3466/32/55639_2.png) [@brg3466](https://forum.mikrotik.com/u/brg3466)\
**Post date:** [October 11, 2020, 8:46pm UTC](https://forum.mikrotik.com/t/script-works-in-terminal-windwo-but-not-in-scheduler/143709/1 "2020-10-11T20:46:26Z")

</div>

Hello,  
I tried to download the backup file in cloud and if I open a new terminal and write below, it works fine.

```plaintext
[brg3466@CCR1009] > {
{... #get backup file download key
{... :local key [/system backup cloud get number=0 secret-download-key];
{...                                                                    
{... # get cloud backup file
{... /system backup cloud download-file action=download secret-download-key="$key";
{... }                                                                             
  status: finished

```

But if put the above in script , it doesn’t work. Anyone knows why ?

---

<div class="post-metadata">

**Author:** ![mrz](https://forum.mikrotik.com/user_avatar/forum.mikrotik.com/mrz/32/308_2.png) [@mrz](https://forum.mikrotik.com/u/mrz)\
**Post date:** [October 12, 2020, 6:29am UTC](https://forum.mikrotik.com/t/script-works-in-terminal-windwo-but-not-in-scheduler/143709/2 "2020-10-12T06:29:29Z")

</div>

get number=0 will not work,  
read this:  
[http://forum.mikrotik.com/t/read-before-creating-yet-another-new-my-script-does-not-work-topic/122693/1](http://forum.mikrotik.com/t/read-before-creating-yet-another-new-my-script-does-not-work-topic/122693/1)

---

<div class="post-metadata">

**Author:** ![eworm](https://forum.mikrotik.com/user_avatar/forum.mikrotik.com/eworm/32/1441_2.png) [@eworm](https://forum.mikrotik.com/u/eworm)\
**Post date:** [October 12, 2020, 2:18pm UTC](https://forum.mikrotik.com/t/script-works-in-terminal-windwo-but-not-in-scheduler/143709/3 "2020-10-12T14:18:20Z")

</div>

Use this:

```plaintext
  # we are not interested in output, but print is
  # required to fetch information from cloud
  / system backup cloud print as-value;
  
  / system backup cloud upload-file action=create-and-upload password=$BackupPassword replace=[get ([ find]->0) name ];

```

If you want this to be fully automated and with notifications have a look at my script [cloud-backup](https://git.eworm.de/cgit/routeros-scripts/about/doc/cloud-backup.md).

---

<div class="post-metadata">

**Author:** ![brg3466](https://forum.mikrotik.com/user_avatar/forum.mikrotik.com/brg3466/32/55639_2.png) [@brg3466](https://forum.mikrotik.com/u/brg3466)\
**Post date:** [October 12, 2020, 6:02pm UTC](https://forum.mikrotik.com/t/script-works-in-terminal-windwo-but-not-in-scheduler/143709/4 "2020-10-12T18:02:07Z")

</div>

@mrz, @eworm, thank you both for the tips. I read mrz’s thread and realized that console number doesn’t work. It is a very informative thread ! I wish I could have read it earlier. 🙂  
A long way to go for good scripting !
