Follow us on...
Follow us on G+ Follow us on Twitter Follow us on Facebook Watch us on YouTube
Register
Results 1 to 4 of 4
  1. #1
    Status
    Offline
    awarmanf's Avatar
    Member
    Join Date
    Apr 2008
    Posts
    222
    Reviews
    Read 0 Reviews
    Downloads
    0
    Uploads
    0
    Feedback Score
    0

    Ambil data dari environment

    RR, bagaimana caranya ambil data environment ?

    Seperti ini contohnya:
    Code:
     :environment print 
    "VAR"="variable"
    "NUM"=100
    Nah, saya mau buat script yg mau ambil isi variable $NUM. How to do it ?

    Masalahnya begini saya buat script yg akan dijalankan secara periodik (schedule), script ini ping ke suatu ip yang sudah diset oleh startup script.

    Isi script yg akan dijalankan pd waktu startup:
    Code:
    :global IPTOPING "125.164.254.1"
    Saya sdh cek di terminal saat sistem boot:
    Code:
    :put $IPTOPING
    125.164.254.1
    Nah, jika saya buat script scheduler yg isinya spt ini:

    Code:
    /ping "$IPTOPING" count=3 size=28
    Kemudian saya jalankan baik lewat schedule maupun langsung run script, saya lihat di torch tdk ada trafik icmp sama sekali. Beda kalau script ping di atas dijalankan di terminal.

    Script saya mampet di sini.

    Mohon pencerahan. Click here to enlarge

  2. #2
    Status
    Offline
    BatavianX's Avatar
    Member Senior
    Join Date
    Dec 2007
    Location
    x-Region
    Posts
    485
    Reviews
    Read 0 Reviews
    Downloads
    0
    Uploads
    0
    Feedback Score
    0
    Kalo dari penerawangan gw, harusnya dideklarasikan lagi pada script, misalkan:

    Di command line, atau di script lain:

    Code:
    :global IP2Ping 125.164.254.1
    :put $IP2Ping
    125.164.254.1
    Di script lain yg juga akan memakai variabel IP2Ping harus mendklarasikan ulang variabel tsb:

    Code:
    :global IP2Ping
    /ping [:toip $IP2Ping] count=5
    CMiiW...!

  3. #3
    Status
    Offline
    awarmanf's Avatar
    Member
    Join Date
    Apr 2008
    Posts
    222
    Reviews
    Read 0 Reviews
    Downloads
    0
    Uploads
    0
    Feedback Score
    0

    Masalah lintas variable di ROS 3.x

    Terimakasih bos atas tanggapannya. Saya lupa kasitahu bahwa masalah tersebut ada di ROS v3.x. Tidak ada masalah kalau script tsb dijalankan di ROS v 2.9.

    Saya buat di System / Script seperti ini:

    Nama: script1
    Code:
    :global NUM 100
    Nama: script2
    Code:
    :global NUM ($NUM+1)
    ROS v2.9
    ----------
    Jika saya run script1 dan buka terminal:
    Code:
    :put $NUM
    100
    Run script2 dan lihat isi variable $NUM di terminal:
    Code:
    :put $NUM
    101
    ROS v3.x
    ----------
    Run script1 dan buka terminal:
    Code:
    :put $NUM
    100
    Run script2 dan lihat isi variable $NUM di terminal:
    Code:
    :put $NUM
    1
    Jadi keliatan kalau di ROS v3.x, variable $NUM jika dideklarasikan ulang dengan operator global akan diset valuenya ke 0. Bagaimana caranya script nya bisa berjalan seperti yg sudah berlaku di ROS v2.9. Click here to enlarge

    Mohon dong pencerahannya.
    Click here to enlarge

  4. #4
    Status
    Offline
    awarmanf's Avatar
    Member
    Join Date
    Apr 2008
    Posts
    222
    Reviews
    Read 0 Reviews
    Downloads
    0
    Uploads
    0
    Feedback Score
    0

    Smile

    Tadi tanya ke forum.mikrotik.com dan dapat jawaban langsung dari petinggi mikrotik. Disuruh buat script di system script seperti ini:

    script1
    Code:
    :global NUM 100;
    script2
    Code:
    :global NUM;
    :set NUM ($NUM+1);
    :put $NUM;
    En mak nyusss.

    Click here to enlarge

 

 

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Mikrotik Bisa jadi data Server??
    By metzebs in forum Beginner Basics
    Replies: 12
    Last Post: 07-01-2009, 16:16
  2. download dari mesin mikrotik,client ngambil dari ftp
    By carrud in forum General Networking
    Replies: 7
    Last Post: 11-04-2008, 08:50
  3. Error Fetching data
    By kismanto in forum Wireless Networking
    Replies: 0
    Last Post: 23-02-2008, 14:39
  4. Memisahkan Data VCon dengan Data biasa..
    By jay039 in forum General Networking
    Replies: 4
    Last Post: 26-01-2008, 11:24

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •