1754175996
This commit is contained in:
+31
-16
@@ -27,28 +27,43 @@ syncstatus () {
|
|||||||
ssh $remote_host "/bin/bash -c git -C $remote_dir status"
|
ssh $remote_host "/bin/bash -c git -C $remote_dir status"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# synchronize git repos on local and remote
|
||||||
gitsync () {
|
gitsync () {
|
||||||
# todo: param and defaults these up
|
echo "INFO | Starting gitsync"
|
||||||
# todo: format this properly as multiline
|
|
||||||
$remote_cmd = "echo -e \"\nREMOTE pull $remote_dir\n\"; git -C $remote_dir pull; echo -e \"\nREMOTE adding on $remote_dir\n\"; git -C $remote_dir add .; echo -e \"\nREMOTE commit $remote_dir\n\"; git -C $remote_dir commit -m \"autosync $(date +%s)\"; echo -e \"\nREMOTE push $remote_dir\n\"; git -C $remote_dir push; echo -e \"\nREMOTE status $remote_dir\n\"; git -C $remote_dir status;"
|
|
||||||
|
|
||||||
echo -e "\nLOCAL pulling\n"
|
# run on remote
|
||||||
git pull
|
ssh $remote_host "git -C \"$remote_dir\" pull | tee -a \"$log_file\""
|
||||||
|
echo "REMOTE | Finished git pull on $remote_host:$remote_dir" $?
|
||||||
|
|
||||||
echo -e "\nLOCAL adding, comitting and pushing\n"
|
ssh $remote_host "git -C \"$remote_dir\" add . | tee -a \"$log_file\""
|
||||||
git add .
|
echo "REMOTE | Finished git adding on $remote_host:$remote_dir" $?
|
||||||
git commit -m "autosync $(date +%s)"
|
|
||||||
git push
|
|
||||||
|
|
||||||
echo -e "\nLOCAL status\n"
|
ssh $remote_host "git -C \"$remote_dir\" commit -m \"autosync at $(date +%s)\" | tee -a \"$log_file\""
|
||||||
git status
|
echo "REMOTE | Finished git commit on $remote_host:$remote_dir" $?
|
||||||
|
|
||||||
# run da REMOTE shiz
|
ssh $remote_host "git -C \"$remote_dir\" push | tee -a \"$log_file\""
|
||||||
echo -e "\nREMOTE running sync\n"
|
echo "REMOTE | Finished git push on $remote_host:$remote_dir" $?
|
||||||
ssh $remote_host "/bin/bash -c \"$remote_cmd\""
|
|
||||||
|
|
||||||
echo -e "\nLOCAL status\n"
|
ssh $remote_host "git -C \"$remote_dir\" status | tee -a \"$log_file\""
|
||||||
git status
|
echo "REMOTE | Finished git status on $remote_host:$remote_dir" $?
|
||||||
|
|
||||||
|
# run on local
|
||||||
|
git pull | tee -a "$log_file"
|
||||||
|
echo "LOCAL | Finished git pulling" $?
|
||||||
|
|
||||||
|
git add . | tee -a "$log_file"
|
||||||
|
echo "LOCAL | Finished git adding" $?
|
||||||
|
|
||||||
|
git commit -m "autosync at $(date +%s)" | tee -a "$log_file"
|
||||||
|
echo "LOCAL | Finished git comitting" $?
|
||||||
|
|
||||||
|
git push | tee -a "$log_file"
|
||||||
|
echo "LOCAL | Finished git pushing" $?
|
||||||
|
|
||||||
|
git status | tee -a "$log_file"
|
||||||
|
echo "LOCAL | Finished git status" $?
|
||||||
|
|
||||||
|
echo "INFO | Finished gitsync"
|
||||||
}
|
}
|
||||||
|
|
||||||
handle_args
|
handle_args
|
||||||
|
|||||||
Reference in New Issue
Block a user