This commit is contained in:
Ramiro Paz
2026-03-09 15:09:06 -03:00
parent 8299f8bc96
commit 0e8fe168ef
85 changed files with 14079 additions and 0 deletions

43
tools/first_deploy.sh Executable file
View File

@ -0,0 +1,43 @@
#!/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: first_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
# Create the service
scp tools/qfixdpl.service "$ssh_alias":/lib/systemd/system/
# Create folder just in case
ssh "$ssh_alias" "systemctl daemon-reload;systemctl enable qfixdpl.service;systemctl start qfixdpl.service;mkdir -p /home/quantex/qfixdpl"
# Create start, stop and restart scripts
scp tools/start "$ssh_alias":/home/quantex/qfixdpl/
scp tools/stop "$ssh_alias":/home/quantex/qfixdpl/
scp tools/restart "$ssh_alias":/home/quantex/qfixdpl/
# Copy zipped binary
scp build/out/distribution/qfixdpl.gz "$ssh_alias":/home/quantex/qfixdpl/
scp tools/unzip-qfixdpl.sh "$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"