#!/bin/bash # Check if the argument is provided if [ -z "$1" ]; then echo "Usage: $0 on|off" sudo zpool get checkpoint # show status of checkpoints echo "if value is - then seatbelts are off" exit 1 fi # Check the argument and perform the corresponding action case "$1" in on) echo "Creating checkpoint for the 'main' pool..." sudo /sbin/zpool checkpoint main if [ $? -eq 0 ]; then echo "Checkpoint created successfully." else echo "Failed to create checkpoint." exit 1 fi ;; off) echo "Discarding checkpoint for the 'main' pool..." sudo /sbin/zpool checkpoint -d main if [ $? -eq 0 ]; then echo "Checkpoint discarded successfully." else echo "Failed to discard checkpoint." exit 1 fi ;; *) echo "Invalid argument. Use 'on' to create a checkpoint or 'off' to discard." exit 1 ;; esac