Created
November 1, 2013 05:13
-
-
Save akiko-pusu/7261204 to your computer and use it in GitHub Desktop.
Jenkins使って良くやるバックアップ (rsync) 作業 ref: http://qiita.com/akiko-pusu/items/da60e402dede4494f1e8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if [ ${DRY_RUN} = "true" ]; then | |
sudo rsync -avnz --delete -e ssh ${SOURCE_SERVER}:/{$SOURCE_DIR}/ {$BACKUP_DIR} | |
else | |
sudo rsync -avz --delete -e ssh ${SOURCE_SERVER}:/{$SOURCE_DIR}/ {$BACKUP_DIR} | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# tty で怒られるのでコメントアウト | |
#Defaults requiretty | |
# バックアップに必要なタスクを定義 | |
Cmnd_Alias BACKUP_TASK = /usr/bin/rsync, /usr/bin/ssh, /usr/bin/du | |
# jenkinsさんには上記タスクはroot権限で実施できるようにする | |
jenkins ALL = (root) NOPASSWD: BACKUP_TASK |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment