Sign inSign up

aevrin/deadswitch

By aevrin

•Updated 1 day ago

Image
0

8.9K

aevrin/deadswitch repository overview

⁠Dead Switch

A Docker-based solution to automatically delete files that are no longer needed. This project monitors a directory for changes and, if unchanged for a set period of time, deletes a set of specified folders.

⁠How it works

  1. The script monitors the /Check directory for changes.
  2. If no changes are detected within the specified time period, it proceeds to delete the contents of the /Delete directory.
  3. The script runs every hour via a cron job inside the Docker container.

⁠Configuration

You can configure the behavior of the Dead Switch using environment variables in the docker-compose.yml file:

  • FOLDER_TO_CHECK: The directory to monitor for changes (default: /Check)
  • TIME_PERIOD: The time period (in seconds) to wait before considering the monitored folder as inactive (default: 86400 seconds, or 24 hours)
  • DELETE_FOLDER: The base directory containing folders to be deleted (default: /Delete)
  • DRY_RUN: If set to "true", the script will only simulate deletion without actually removing files (default: true)

⁠Usage

  1. Clone this repository to your local machine.

  2. Modify the docker-compose.yml file to set your desired configuration and volume mappings.

  3. Build and start the Docker container:

    docker-compose up -d
    
  4. The Dead Switch will now run automatically according to the specified configuration.

⁠Caution

Be very careful when using this tool, as it can permanently delete files. Always test thoroughly with DRY_RUN=true before enabling actual deletion.

⁠License

[Specify your license here]

Tag summary

Content type

Image

Digest

sha256:c8c3e2c39…

Size

78 MB

Last updated

1 day ago

docker pull aevrin/deadswitch