deploy/copy.sh

c6c5cb340929ee44650344d2fe40f5badb7bd65a
gitbay/deploy/copy.sh

14 lines · 551 bytes · executable

 1#!/bin/sh
 2# Copy one file to the host: rsync when the host has it, since a stalled
 3# transfer then resumes and the bytes are compressed on the wire; scp -C
 4# otherwise. Both deploy targets go through here so neither can assume a
 5# tool the host lacks.
 6#
 7#   deploy/copy.sh <host> <port> <local-file> <remote-path>
 8set -eu
 9host=$1 port=$2 src=$3 dst=$4
10if ssh -p "$port" "root@$host" 'command -v rsync >/dev/null 2>&1'; then
11  rsync --partial --inplace -z -e "ssh -p $port" "$src" "root@$host:$dst"
12else
13  scp -C -P "$port" "$src" "root@$host:$dst"
14fi
Keyboard shortcuts

Global

⌘K
Command palette & jump
/
Focus search
?
Show this help
g d
Dashboard
g e
Explore repositories
g n
Notifications

Repository & editor

t
Find file in repository
y
Copy immutable SHA permalink
g c
Code tab
g i
Issues tab
g m
Merge requests tab
g b
Builds tab
⌘↵
Submit active form