Unit File Download Tool
Downloading files from the unit to the development often need to first download to their own computer, and then layer upload, very inconvenient.
So I made a tool. Download the files on the unit directly on the development server.
Program Location
[Email PROTECTED]:~/BIN/UNIT-DL
[Email PROTECTED]:~/BIN/UNIT-DL
How to use
$ unit-dl <URL> [<save-as-file>]
<URL> is the URL of the file that needs to be downloaded.
<save-as-file> is what file name you want to save. This can not be provided.
Cases
$ Unit-dl ' http://unit.sunseer.co.jp/attachments/11115/4989-YSP-campaign.gif '
$ Unit-dl ' http://unit.sunseer.co.jp/attachments/11115/4989-YSP-campaign.gif ' save_as_1.gif
The program asks you for your username and password when you log in to the unit.
--------------------------
unitip=202.248.23.108
Export lang=en
UrlEncode () {
Echo-n "$" | Xxd-p | Sed-r ' s/. /%\0/g '
}
Targeturl= "$"
Outfile= "$"
If [-Z "$TARGETURL"]; Then
echo "error:the first argument should be a URL." >&2
Exit 1
Fi
Echo-n "Unit Username:"
Read USERNAME
Echo-n "Unit Password:"
Read-s PASSWORD
If [-Z ' $USERNAME '] | | [-Z "$PASSWORD"]; Then
echo "Error:both username and password are required." >&2
Exit 1
Fi
If [-Z "$OUTFILE"]; Then
Outfilearg= ""
Else
outfilearg= "-O $OUTFILE"
Fi
Cookiefile= ' Mktemp '
Trap "rm $COOKIEFILE" EXIT
Env http_proxy= $UNITIP \
wget--quiet-o-\
--http-user=sunseer \
--http-password=redmine \
--save-cookies= $COOKIEFILE \
--keep-session-cookies \
--post-data= "username=$ (urlencode" $USERNAME ") &password=$ (UrlEncode" $PASSWORD ")" \
' Http://unit.sunseer.co.jp/login ' \
>/dev/null
Env http_proxy= $UNITIP \
Wget $OUTFILEARG \
--http-user=sunseer \
--http-password=redmine \
--load-cookies= $COOKIEFILE \
--save-cookies= $COOKIEFILE \
--keep-session-cookies \
"$TARGETURL"
(Script for downloading website files directly on the server-pending modification)