Community discussions

MikroTik App
 
jonm
newbie
Topic Author
Posts: 47
Joined: Thu Jul 01, 2004 7:49 am
Location: Indiana, USA
Contact:

Can't get basic 2 line script to work.

Fri Nov 12, 2004 7:44 pm

Hey all, I'm trying to write a script to disable dhcp and pppoe. However, everytime I run the script I either get an error like 'input does not match any value of item name' or I do not receive an error but the actions are not carried out? Any ideas here?

/system script set 0 source={/interface pppoe-server server disable 0\n/ip dhcp-server disable 0}

Any help would be appreciated here. :!:
 
mp3turbo2
Member Candidate
Member Candidate
Posts: 196
Joined: Wed Jun 02, 2004 9:15 am

Sat Nov 13, 2004 9:27 pm

you must issue 'print' command before, because disable 0 can't be interpreted.
 
jonm
newbie
Topic Author
Posts: 47
Joined: Thu Jul 01, 2004 7:49 am
Location: Indiana, USA
Contact:

Mon Nov 15, 2004 2:33 am

Print command? I can't find one in the manual and I get error message about it not being valid when I try to use it (I'm using ver 2.8.18). Do you mean the PUT command?

I've tried that too, no error messages are logged, but the action is not performed when I run the script any ideas here? I think scripting is broken or something. Here is what I'm trying (using the put command).

:put "/ip dhcp-server disable 0\n"
 
User avatar
Eugene
Forum Veteran
Forum Veteran
Posts: 986
Joined: Mon May 31, 2004 5:06 pm
Location: Cranfield, UK

Mon Nov 15, 2004 9:54 am

The item numbers in console are assigned by print command, therefore it is not possible to reference items by item number from scripts. You could try the following:
/system script set 0 source={/interface pppoe-server server disable 0\n/ip dhcp-server disable [/ip dhcp-server find]} 
or reference the item by name, exempli gratia /ip dhcp-server disable dhcp1.
 
jonm
newbie
Topic Author
Posts: 47
Joined: Thu Jul 01, 2004 7:49 am
Location: Indiana, USA
Contact:

Sat Nov 27, 2004 12:14 am

Eugene!

That works for the DHCP but not for the pppoe-server ;( pppoe server entires have service-names and not just plain names. Any ideas would be greatly appreciated!
 
User avatar
Eugene
Forum Veteran
Forum Veteran
Posts: 986
Joined: Mon May 31, 2004 5:06 pm
Location: Cranfield, UK

Mon Nov 29, 2004 11:24 am

/interface pppoe-server server disable [/interface pppoe-server server find]
 
jonm
newbie
Topic Author
Posts: 47
Joined: Thu Jul 01, 2004 7:49 am
Location: Indiana, USA
Contact:

Mon Nov 29, 2004 3:24 pm

ah hah! That works! Thanks.