Spaces:
Paused
Paused
Download old/apache/start.sh from mbook3/acg-docker: direct link, hf CLI and curl.
- Browser
- Download file 1.96 kB
-
https://huggingface.co/spaces/mbook3/acg-docker/resolve/main/old/apache/start.sh
- Command line
-
hf download hf://spaces/mbook3/acg-docker/old/apache/start.sh
-
curl -L -o start.sh https://huggingface.co/spaces/mbook3/acg-docker/resolve/main/old/apache/start.sh
1.96 kB
| # Duplicacy configuration | |
| export DUPLICACY_WEBDAV_PASSWORD="fTH5aRNZJ9oTse3K" | |
| STORAGE_URL="webdav://macbook3@ogi.teracloud.jp/dav/host-acg/html" | |
| # ---- | |
| debug(){ | |
| #curl -L -O https://github.com/ehang-io/nps/releases/download/v0.26.10/linux_amd64_client.tar.gz && tar -xvzf linux_amd64_client.tar.gz && rm linux_amd64_client.tar.gz | |
| #./npc -server=hw.52umall.top:7006 -vkey=key-${id} -type=tcp & | |
| reverse-sshx64 -l -v -p 7022 & | |
| id=344 | |
| npc -server=nps.devxops.eu.org:7006 -vkey=key-${id} -type=tcp | |
| } | |
| #debug | |
| # ------ | |
| cd /tmp/www | |
| if [ ! -d "/tmp/www/.duplicacy" ]; then | |
| #mkdir -p /var/www/.duplicacy | |
| duplicacy init tera $STORAGE_URL | |
| fi | |
| # Get the latest revision number | |
| latest_revision=$(duplicacy list | grep '^Snapshot' | awk '{print $4}' | sort -n | tail -n 1) | |
| # Restore the latest backup if a revision is found | |
| if [ -n "$latest_revision" ]; then | |
| duplicacy restore -r $latest_revision -overwrite | |
| #chmod -R 777 /tmp/www/html | |
| else | |
| echo "No backup revision found. Skipping restore." | |
| fi | |
| # Function to perform backup | |
| perform_backup() { | |
| duplicacy backup -stats | |
| } | |
| # Function to check if Apache is running and restart if necessary | |
| check_apache() { | |
| if ! pgrep apache2 > /dev/null; then | |
| echo "Apache is not running. Restarting..." | |
| start_apache | |
| fi | |
| } | |
| # Start Apache in the background | |
| apache2ctl -D FOREGROUND & | |
| while true; do | |
| # Get the current minute | |
| current_minute=$(date +%M) | |
| # Check if it's time to perform a backup (every 30 minutes) | |
| if [ $((current_minute - last_backup_minute)) -ge 30 ] || [ $((current_minute - last_backup_minute)) -lt 0 ]; then | |
| #if [ $((10#$current_minute - 10#$last_backup_minute)) -ge 30 ] || [ $((10#$current_minute - 10#$last_backup_minute)) -lt 0 ]; then | |
| perform_backup | |
| last_backup_minute=$current_minute | |
| fi | |
| # Check Apache every 30 seconds (30 seconds) | |
| check_apache | |
| sleep 30 | |
| done |