Last active
December 30, 2015 15:59
-
-
Save aka-toxa/7851913 to your computer and use it in GitHub Desktop.
bash script for screenshots autoupload to the ftp via Apple Automator on OS X
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
#!/bin/sh | |
# Author: Petrovskiy Anatoliy @ http://netpeak.ua/team/toxa | |
# Тут указываем данные для подключения к ФТП серверу | |
HOST='FTPHOST' | |
USER='FTPUSER' | |
PASSWD='FTPPWD' | |
REMOTEFILE='/'$RANDOM$RANDOM'.png' | |
# Вместо URLTOFILE пишем базовый http урл для доступа к картинке (прим. http://myftpserver.com/toxa) | |
URL='URLTOFILE'$REMOTEFILE | |
# так-как выгрузка может занять какое-то время, сохраним ссылку на файл в буфер обена сразу, а уже потом будем загружать | |
echo $URL | pbcopy | |
SCREENSHOTFILE=$@ | |
cp "$SCREENSHOTFILE" ~/tmp.png | |
ftp -n $HOST <<END_SCRIPT | |
quote USER $USER | |
quote PASS $PASSWD | |
binary | |
put ~/tmp.png $REMOTEFILE | |
bye | |
END_SCRIPT | |
rm ~/tmp.png |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment