diff --git a/README.md b/README.md index 0cc2528..752c7e1 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,13 @@ -# Swap File Creation Script +# Log Retrieval Script -This script automatically creates a swap file on your system, allowing you to increase the available virtual memory. It calculates the optimal swap file size based on the available disk space, ensuring that the swap file does not exceed 30GB or 5% of the free disk space, whichever is smaller. +This script allows you to retrieve logs from a server based on a specified date and time range. It uses `journalctl` to extract logs within the provided time window, saving them to a file for easy access. ## Features -- Detects the main disk partition used by the system. -- Calculates the optimal swap file size (up to 30GB or 5% of the free space). -- Creates and activates a swap file at `/swapfile`. -- Optionally persists the swap file across reboots using the `--persist` flag. -- Displays the status of the created swap file. +- Retrieves logs using `journalctl` from the specified start and end date/time. +- Automatically saves the logs to a file for future reference. +- Ensures logs are only retrieved within the given time frame. +- Checks if `journalctl` is available on the system before execution. ## Usage @@ -19,26 +18,25 @@ To use this script, you can execute it directly from the URL without downloading Run the script directly from the URL using `curl` and piping to `bash`: ```bash -curl -sSL https://git.nixc.us/colin/swap-increase/raw/branch/main/swap.sh | bash +curl -sSL https://git.nixc.us/colin/pull-logs/raw/branch/main/pull-logs.sh | bash -s -- ``` -### Persist the Swap File Across Reboots +### Example -To ensure the swap file is persisted across reboots, run the script with the `--persist` flag: +To pull logs between `2024-09-26 08:00:00` and `2024-09-26 12:00:00`, use: ```bash -curl -sSL https://git.nixc.us/colin/swap-increase/raw/branch/main/swap.sh | bash -s -- --persist +curl -sSL https://git.nixc.us/colin/pull-logs/raw/branch/main/pull-logs.sh | bash -s -- 2024-09-26 08:00:00 2024-09-26 12:00:00 ``` ## Output The script will provide the following output: -- The calculated size of the swap file. -- Confirmation of swap file creation and activation. -- Whether the swap file will persist after reboot (based on the `--persist` flag). -- Information on the current swap status using `swapon --show`. +- The range of the logs retrieved. +- The location where the logs are saved (in `/tmp` with a filename indicating the time range). +- A message indicating if `journalctl` is not available on the system. ## Note -This script requires `sudo` privileges to create and activate the swap file, as well as to modify the `/etc/fstab` file for persistence across reboots when using the `--persist` flag. \ No newline at end of file +This script assumes the logs are managed by `journalctl`. It may require `sudo` privileges to access certain system logs. Ensure you have appropriate permissions to execute the script. \ No newline at end of file