Last active
March 8, 2020 19:31
-
-
Save qaisjp/9fb1e77ca81399a43391d66d1d6e55ae to your computer and use it in GitHub Desktop.
go-discord-irc upload script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
# Usage: GOOS=linux go build && ssh discord.tardis ./replace.sh < go-discord-irc | |
set -u | |
set -e | |
target=$(tempfile) | |
echo "Copying file to \"$target\"" | |
cp /dev/stdin "$target" | |
echo "File copied to \"$target\"" | |
echo 'Stopping service "discordirc"' | |
service discordirc stop | |
oldtarget=~/go-discord-irc-$(date +"%Y-%d-%m_%H-%M-%S") | |
echo "Copying \"/usr/local/bin/go-discord-irc\" to \"$oldtarget\"" | |
cp /usr/local/bin/go-discord-irc "$oldtarget" | |
echo "Copying \"$target\" to \"/usr/local/bin/go-discord-irc\"" | |
cp "$target" /usr/local/bin/go-discord-irc | |
echo "Deleting \"$target\"" | |
rm "$target" | |
echo 'Starting service "discordirc"' | |
service discordirc start | |
echo "Success!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment