add default sleep value and update README.md

This commit is contained in:
Terry Chen 2015-08-14 10:02:56 +08:00
parent 271994965f
commit f8896a5dea
2 changed files with 10 additions and 9 deletions

View File

@ -3,18 +3,17 @@
Base on Ubuntu, using Docker to construct your Apt mirror HTTP server
## Usage
Using default [mirror.list!](mirror.list)
```
docker run -v /path/data:/var/spool/apt-mirror \
-d -p port_number:80 seterrychen/apt-mirror-http-server
```
Using your mirror.list
Running command
```
docker run -v /path/data:/var/spool/apt-mirror \
-v /path/your/mirror.list:/etc/apt/mirror.list \
-e TIMEOUT=timeout-value
-d -p port_number:80 seterrychen/apt-mirror-http-server
```
/path/data is where to store data, and the TIMEOUT var to repeatedly execute apt-mirror.
If you don't setting variable of mirror.list and TIMEOUT, it will using the default [mirror.list](mirror.list), and
the default TIMEOUT is 6 hours. To see the [TIMEOUT format description](http://www.cyberciti.biz/faq/linux-unix-sleep-bash-scripting/)
## Note
It will take time to download, then start http server. Using ``docker logs -f container-id`` to check the process.

View File

@ -5,6 +5,7 @@ mkdir /var/www/package
sed -i '12s/DocumentRoot \/var\/www\/html/DocumentRoot \/var\/www\/package/' /etc/apache2/sites-enabled/000-default.conf
service apache2 restart
UNIT=${TIMEOUT:-12h}
while true; do
# parse mirror.list to share under /var/www/package path
@ -20,7 +21,8 @@ while true; do
fi
done
printf "\n\n====== wait $TIMEOUT to execute apt-mirror command ======\n\n"
sleep $TIMEOUT
apt-mirror
printf "\n\n====== wait $UNIT to execute apt-mirror again ======\n\n"
sleep $UNIT
done