微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

使用任务计划程序在Synology上复制文件

如何解决使用任务计划程序在Synology上复制文件

我正在尝试将一个小的文本文件从“ web”主文件夹的不同子文件夹下的位置复制/复制到该位置。

来源是“ web / Domoos / PHP_scripts / auto / file / myfox_token.txt”,目的地是“ web / Demo / 0h / PHP_scripts / auto / file / myfox_token.txt”。

基于上一篇关于stackoverflow(Copying local files with curl)的文章,我试图在Synology DS415 +中实现此逻辑,该逻辑在DSM版本6.2.3(更新2)下运行,方法添加新任务并输入在命令行中进行以下操作:

curl -o file://"web/Domoos/PHP_scripts/auto/file/myfox_token.txt" > "web/Demo/0h/PHP_scripts/auto/file/myfox_token.txt"

不幸的是,我没有成功。然后,我尝试使用NAS的IP地址(192.168.X.X)输入相同的密码:

curl -o "192.168.X.X/web/Domoos/PHP_scripts/auto/file/myfox_token.txt" > "192.168.X.X/web/Demo/0h/PHP_scripts/auto/file/myfox_token.txt"

这也不成功。

可能是Synology不支持“ curl”功能吗?

非常感谢您阅读我的文章和最良好的祝愿。

解决方法

我回应自己,希望这篇文章对其他人有所帮助。

我创建了一个bash脚本,并进入了任务计划程序编辑器“任务设置”的第3个选项卡。

我输入了以下内容

#!/bin/bash
# For demo 0h folder
sleep 15s
cp /volume1/web/Domoos/php_scripts/auto/file/myfox_token_extracted.txt /volume1/web/Demo/0h/php_scripts/auto/file/myfox_token_extracted.txt

enter image description here enter image description here enter image description here

请记住:

  1. #!/ bin / bash是所谓的“ Shebang”,它将指示您的Synology OS将其余的命令行解析为解释器指令。
  2. 第二行只是一个注释示例,以井号(#)开头。

最良好的祝愿并保持健康

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。