Created
July 15, 2020 19:26
-
-
Save rojenzaman/7c3a77603df222cc245923fabee39fe5 to your computer and use it in GitHub Desktop.
Site Archiver Script - For simple manage HTTRACK
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/bash | |
###config### | |
dir="~"; | |
############ | |
#variables | |
url=$1; | |
title=$2; | |
filename=archive-$(date +"%Y-%m-%d_%H-%M_%S").log; | |
#check strings | |
function param() { | |
[ -z "$url" ] && guide; | |
[ -z "$title" ] && guide; | |
} | |
#man page | |
function guide() { | |
echo -e "usage: ./`basename $0` SITE-URL \"TITLE\""; | |
exit 1; | |
} | |
#httrack control | |
function call_httrack() { | |
dpkg -s httrack &> /dev/null || echo "httrack not installed, please install httrack and run it." || exit 1; | |
} | |
#httrack command | |
function run() { | |
nohup httrack $url -O $dir/"$title" -%v > $filename & | |
} | |
#value sufficiency entered while running the script | |
if [ "$#" -lt 1 ]; then | |
guide; | |
fi | |
if [ "$#" -gt 2 ];then | |
guide; | |
fi | |
#called param for check strings | |
param; | |
#run httrack control | |
call_httrack && echo -e "using httrack..\n"; | |
echo "$url"; | |
echo -e "$title\n"; | |
echo "starting..."; | |
#run httrack | |
run &> /dev/null; | |
echo -e "\n logs are in $filename file"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Site Archiver Script - For simple manage HTTRACK
usage