Temat: webif + pobieranie FTP i WWW
znalazlem takie male ciekawe rozwiazanie :
http://forum.openwrt.org/viewtopic.php?id=9370
Dodalem jednego "if" ,ktory definiuje domyslny katalog :
if [ "$FORM_dest" = "" ]; then
FORM_dest=/mnt/usb/download
fi
Zastanawiam sie jak mozna zrobic by wywolywany wget dzialal na screen.
screen -t 'echo "$FORM_pkg"' wget -c -P `echo "$FORM_dest"` `echo "$FORM_pkg" | sed -e 's, ,+,g'`
lub
screen -S 'echo "$FORM_pkg"' wget -c -P `echo "$FORM_dest"` `echo "$FORM_pkg" | sed -e 's, ,+,g'`
Niestety nie udalo mi sie, dostaje nastepujacy komunikat :
"Must be connected to a terminal."
To wydaje sie logiczne i zrozumiale. jak mozna ominac ten problem ??
Znalazlem opcje -T (screen -T) ale jaki tu podac terminal ?
a moze wyjsciem jest odpalenie screen pod konsola, a tu tylko odwolanie sie do tej sesji ??
Zalaczam cale oryginalne rozwiazanie :
#!/usr/bin/webif-page
<?
. /usr/lib/webif/webif.sh
header "Downloader" "System" "@TR<<Downloader>>" '' "$SCRIPT_NAME"
##################################################################
#
# Download from URL
#
! empty "$FORM_install_url" && {
FORM_action="install"
FORM_pkg="$FORM_url"
}
display_form <<EOF
start_form|@TR<<Download From URL>>
field|@TR<<URL of Package>>
text|url|$FORM_url
field|@TR<<Destinaition (/mnt)>>
text|dest|$FORM_dest
field|
submit|install_url|Download From URL |
end_form
EOF
# Block ends
##################################################################
?>
<?
echo "<pre>"
if [ "$FORM_action" = "install" ]; then
echo "@TR<<Please wait>> ...<br />"
wget -c -P `echo "$FORM_dest"` `echo "$FORM_pkg" | sed -e 's, ,+,g'`
fi
echo "</pre>"
?>
</pre>
<?
# todo: temporary fix for a display error in Opera
display_form <<EOF
start_form||||nohelp
end_form
EOF
footer ?>
<!--
##WEBIF:name:Downloader:0:Downloader
-->