Send :local variable with /tool fetch without saving variable in file.

huangapple go评论65阅读模式
英文:

Send :local variable with /tool fetch without saving variable in file

问题

我想编写一个脚本,使用 Mikrotik 的 /tool fetch 将图像从我的服务器发送到ftp,并将其添加到调度程序中,以便每分钟执行一次。我的图像保存在“img”变量中。如何在不将此图像保存为文件的情况下将其发送到ftp?

    :local img [/tool fetch user="user" password="password" url="http://192.168.1.1/image.jpg" mode=http as-value output=user];
    /tool fetch address="my.ftp.com" src-path=$img user=ftpuser mode=ftp password=ftppassword dst-path="/ftpimage.jpg" upload=yes

附言:我不想将此图像保存为文件,因为每分钟持续写入可能会在短时间内损坏我的交换机的只读存储器。
英文:

I want to write script for sending images from my server to ftp with Mikrotik /tool fetch and add it to scheduler, for every minute executing. My image keep in "img" variable. How can I send it to ftp without saving this image in file?

:local img [/tool fetch user="user" password="password" url="http://192.168.1.1/image.jpg" mode=http as-value output=user];
/tool fetch address="my.ftp.com" src-path=$img user=ftpuser mode=ftp password=ftppassword dst-path="/ftpimage.jpg" upload=yes

P.S. I don't wan't to save this image in file, because continual every minute writing can break rom memory of my switch in a short time.

答案1

得分: 1

如果您的路由器有一个 /flash 子目录,那么这意味着 / 目录是一个 RAMDisk。因此,您可以安全地每分钟在那里存储文件,而不会损坏磁盘。

来源:https://help.mikrotik.com/docs/pages/viewpage.action?pageId=2555971

如果您没有 /flash 子目录,那么可以使用廉价的外部 USB 键作为临时磁盘,并每6个月更换它。

英文:

If your router has a /flash subdirectory, it means that the / directory is a RAMDisk. So you can safely store there files every minute without damaging disk.

Source: https://help.mikrotik.com/docs/pages/viewpage.action?pageId=2555971

If you don't have a /flash subdirectory, well, use a cheap external USB key as temporary disk and replace it every 6 months.

huangapple
  • 本文由 发表于 2023年7月6日 19:07:09
  • 转载请务必保留本文链接:https://go.coder-hub.com/76628174.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定