Skip to content

Instantly share code, notes, and snippets.

@qaisjp

qaisjp/import.sh

Last active Mar 8, 2020
Embed
What would you like to do?
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