文件与目录备份
sudo tar -czvf jsp_backup.tar.gz /path/to/jsp_project。rsync -avz /local/path user@remote:/backup/path。数据库备份
mysqldump工具导出数据,如mysqldump -u user -p dbname > backup.sql,可在JSP中通过Runtime.getRuntime().exec()调用。git commit和git checkout实现版本回溯。自动化备份
crontab定时执行备份脚本,如0 2 * * * /path/to/backup.sh。文件与目录恢复
tar -xzvf backup.tar.gz -C /restore/path。rsync -avz user@remote:/backup/path /local/restore。数据库恢复
mysql命令导入备份文件,如mysql -u user -p dbname < backup.sql。git checkout commit-hash。参考来源: