如果我将一个 shell 脚本放在 中/etc/cron.daily/
,它将在一天中的什么时间执行?
在 gmail.com 上,我看到了这个:
已使用 15 GB 的 0.38 GB (2%)
我的 30 GB 分区中有 20 GB 装满了 Ubuntu 的东西,但可能只有 1 GB 的重要文件,那么为什么不使用这个免费的云存储进行备份呢?
是否已经有一个程序可以做到这一点?反正我可能会写一个,但在开始之前想问问。
我还想要文件压缩和分段,因为有些系统有 10 MB 的附件限制(比如工作中的那个)。
谢谢 :)
我正在托管一个页面并可以通过 ssh 访问该网络空间。
该网站允许其用户进行修改。为了能够将其恢复到较旧的状态,我考虑使用 rsync 每 30 分钟创建一次增量备份,使用 cron 启动以下脚本。
#!/bin/bash
# Binaries
RSYNC=`which rsync`
LN=`which ln`
MKDIR=`which mkdir`
#TODO: Is this enough to make the script distro independent?
# Other Variables
source="<username>@<provider>:<workspace path>"
target="<local backup path>"
# Date ...
year=$(date +%Y)
month=$(date +%m)
day=$(date +%d)
# ... and time
hour=$(date +%H)
minute=$(date +%M)
# Prepare directories
$MKDIR -p $target/$year/$month/$day/"$hour"_"$minute"/
# TODO: Why is this necessary? The actual backup won't work without this line
# saying "directory does not exist...". …
Run Code Online (Sandbox Code Playgroud) 我将创建一个 shell 脚本文件来压缩主目录中的所有文件,但是在我更改权限后 tar 没有运行。
#!/bin/bash
tar -zxvf homefiles.tar.gz /home/
Run Code Online (Sandbox Code Playgroud)