Files
qfixdpl/tools/deploy.sh
Ramiro Paz 0e8fe168ef fiumba
2026-03-09 15:09:06 -03:00

34 lines
839 B
Bash
Executable File

#!/bin/sh
while getopts "a:" opt; do
case $opt in
a)
ssh_alias=$OPTARG
;;
\?)
echo "Invalid option: -$OPTARG" >&2
exit 1
;;
esac
done
# Check if the alias is not empty
if [ -z "$ssh_alias" ]; then
echo "\033[31mPlease input an ssh alias. Usage: deploy.sh -a {ssh_alias}"
exit 1
fi
# Check if the build exists
if [ ! -f "build/out/distribution/qfixdpl.gz" ]; then
echo "\033[31mFile build/out/distribution/qfixdpl.gz does not exist. Run make build"
exit 1
fi
# Copy zipped binary
scp build/out/distribution/qfixdpl.gz "$ssh_alias":/home/quantex/qfixdpl/
# Unzip the binary. Then systemd restart it automatically on file change.
ssh "$ssh_alias" "chown quantex:quantex -R /home/quantex/qfixdpl;chmod +x /home/quantex/qfixdpl/unzip-qfixdpl.sh; /home/quantex/qfixdpl/unzip-qfixdpl.sh"