我将尝试解释此备份的要求。我认为这很简单,但对我来说不是,因为我不习惯使用linux。
场景。对于通过SCP的服务器Linux,我想从防火墙获取每日日志。它登录的防火墙存储在/StoneSoft/StoneGate/data/storage/Firewall/year2019/month09/day25/hour07/file_with_date.arch
我运行了一个scp,我可以复制而没有问题。我需要编写一个bin sh脚本,以便每天复制区分年,月,日和小时变量的文件夹。
yearXXXX月XX天XXhourXX
这有可能吗?
问候
#!/bin/bash
yearXXXX=${1:-2019}
monthXX=${2:-09}
dayXX=${3:-25}
hourXX=${4:-07}
destination=backup/$yearXXXX/$monthXX/$dayXX/$hourXX/
mkdir -p $destination
scp /StoneSoft/StoneGate/data/storage/Firewall/$yearXXXX/$monthXX/$dayXX/$hourXX/*.arch $destination