Community discussions

MikroTik App
 
ejmerkel
newbie
Topic Author
Posts: 33
Joined: Wed Jun 03, 2009 8:26 pm

Copy script source into scheduler

Fri Aug 13, 2010 11:28 pm

Is there a way to copy the script source from a file that's been ftp'd or scp'd to device into the script scheduler? I have a large number of devices I want to copy a script to and then schedule to run.

Is my only option to use
/sys script add name=test source="SOME HUGE AMOUNT OF TEXT"
Eric
 
changeip
Forum Guru
Forum Guru
Posts: 3833
Joined: Fri May 28, 2004 5:22 pm

Re: Copy script source into scheduler

Sat Aug 14, 2010 9:14 am

from the router you developed the script on just run /system script export. then copy the piece you need and make a text file with it. then upload it with extension .rsc.auto (or .auto.rsc or whatever) and it will auto execute - and add your script.
 
jpil
just joined
Posts: 8
Joined: Wed Feb 15, 2017 2:48 am

Re: Copy script source into scheduler

Wed Feb 15, 2017 6:19 am

Thread is old but posting here since google may lead someone here in the future...

if your text is in scripts/foo.rsc and you want to create a script called myscript:
/system script add name=myscript source=[/file get scripts/foo.rsc contents]
This will evaluate the potion in the braces which produces the content of the file and use that content as the value for source. Once you have the script "registered" you can use the /system scheduler to invoke it, etc.

-jp