mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-23 07:15:15 +00:00
deploy.sh: improve user/home var detection
This commit is contained in:
parent
1671e494d3
commit
b368a66760
15
deploy.sh
15
deploy.sh
|
@ -37,8 +37,8 @@ bin_type=bbgo-slim
|
||||||
host_bin_dir=bin
|
host_bin_dir=bin
|
||||||
|
|
||||||
host=bbgo
|
host=bbgo
|
||||||
host_user=root
|
# host_user=ubuntu
|
||||||
host_home=/root
|
# host_home=/root
|
||||||
|
|
||||||
host_systemd_service_dir=/etc/systemd/system
|
host_systemd_service_dir=/etc/systemd/system
|
||||||
host_os=linux
|
host_os=linux
|
||||||
|
@ -123,6 +123,11 @@ if [[ $(remote_test "-e $host_systemd_service_dir/$target.service") != "yes" ]];
|
||||||
host_home=$(remote_eval "\$HOME")
|
host_home=$(remote_eval "\$HOME")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ -z $host_user ]]; then
|
||||||
|
host_user=$(remote_eval "\$USER")
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
cat <<END >".systemd.$target.service"
|
cat <<END >".systemd.$target.service"
|
||||||
[Unit]
|
[Unit]
|
||||||
After=network-online.target
|
After=network-online.target
|
||||||
|
@ -141,10 +146,12 @@ RestartSec=30
|
||||||
END
|
END
|
||||||
|
|
||||||
info "uploading systemd service file..."
|
info "uploading systemd service file..."
|
||||||
scp ".systemd.$target.service" "$host:$host_systemd_service_dir/$target.service"
|
scp ".systemd.$target.service" "$host:$target.service"
|
||||||
|
remote_run "sudo mv -v $target.service $host_systemd_service_dir/$target.service"
|
||||||
|
# scp ".systemd.$target.service" "$host:$host_systemd_service_dir/$target.service"
|
||||||
|
|
||||||
info "reloading systemd daemon..."
|
info "reloading systemd daemon..."
|
||||||
remote_run "sudo systemctl daemon-reload && systemctl enable $target"
|
remote_run "sudo systemctl daemon-reload && sudo systemctl enable $target"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user