Skip to content

Instantly share code, notes, and snippets.

@rojenzaman
Created July 15, 2020 19:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rojenzaman/7c3a77603df222cc245923fabee39fe5 to your computer and use it in GitHub Desktop.
Save rojenzaman/7c3a77603df222cc245923fabee39fe5 to your computer and use it in GitHub Desktop.
Site Archiver Script - For simple manage HTTRACK
#!/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";
@rojenzaman
Copy link
Author

Site Archiver Script - For simple manage HTTRACK

usage

./site-archiver.sh SITE-URL "TITLE"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment