This website works better with JavaScript.
Home
Explore
Help
Sign In
leiyun
/
crontab_backup
Watch
1
Star
0
Fork
0
Code
Issues
0
Pull Requests
0
Releases
0
Wiki
Activity
Browse Source
crontab备份
master
姚子军
3 years ago
parent
acaf6b95e6
commit
27c5ff4ef6
2 changed files
with
18 additions
and
0 deletions
Split View
Diff Options
Show Stats
Download Patch File
Download Diff File
+9
-0
backup.sh
+9
-0
gitrun.sh
+ 9
- 0
backup.sh
View File
@@ -0,0 +1,9 @@
#!/usr/bin/env bash
BACKUP_DIRECTORY="/home/crontab_backup"
if [ ! -e "${BACKUP_DIRECTORY}" ]; then
mkdir -p ${BACKUP_DIRECTORY}
fi
crontab -l > ${BACKUP_DIRECTORY}/$(date '+%Y%m%d%H%M%S').txt
+ 9
- 0
gitrun.sh
View File
@@ -0,0 +1,9 @@
在root目录下创建run.sh脚本
vim run.sh
# 文件内容如下
#!/bin/sh
cd /home/crontab_backup
git add .
git commit -m "crontab备份"
git push
# 保存
Write
Preview
Loading…
Cancel
Save