Skip to content

Instantly share code, notes, and snippets.

@qaisjp
Last active March 8, 2020 19:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save qaisjp/9fb1e77ca81399a43391d66d1d6e55ae to your computer and use it in GitHub Desktop.
Save qaisjp/9fb1e77ca81399a43391d66d1d6e55ae to your computer and use it in GitHub Desktop.
go-discord-irc upload script
#!/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