Things to do near Smith mountains
- User
Things to do near Smith mountains
- Assistant
-
Visit Smith Mountain Lake State Park: Enjoy hiking, swimming, fishing, and boating in this beautiful state park located near Smith Mountain.
-
Explore the Blue Ridge Parkway: Take a scenic drive along the Blue Ridge Parkway and enjoy breathtaking views of the surrounding mountains, forests, and landscapes.
-
Visit the Booker T. Washington National Monument: Learn about the life and work of Booker T. Washington, a prominent African-American educator and leader, at this historic site located near Smith Mountain.
-
Go wine tasting: Explore the nearby wineries and vineyards in the Blue Ridge Mountains and enjoy wine tastings and tours.
-
Take a boat tour: Experience the beauty of Smith Mountain Lake by taking a boat tour, which will allow you to soak in the picturesque views and learn about the area's history and wildlife.
-
Go fishing: Smith Mountain Lake is known for its excellent fishing opportunities. Spend a day fishing for a variety of species including bass, catfish, and crappie.
-
Try water sports: Whether it's jet skiing, paddleboarding, or kayaking, the calm waters of Smith Mountain Lake provide the perfect setting for various water sports activities.
-
Visit local farms and farmers markets: Support the local community by visiting nearby farms and farmers markets to purchase fresh produce, artisanal products, and homemade goods.
-
Go hiking and biking: Explore the numerous hiking and biking trails in the area, such as the Appalachian Trail or the Smith Mountain Lake Community Park trails.
-
Attend local events and festivals: Check out the local event calendar for festivals, concerts, and community events happening near Smith Mountain. These are great opportunities to experience the local culture and enjoy live music and entertainment.
-
- User
Write a bash script to delete logs older then 2 days
- Assistant
Sure! Here's a sample bash script that deletes log files older than 2 days:
#!/bin/bash # Set the directory path where the log files are located log_directory="/path/to/log/files" # Find and delete log files older than 2 days find "$log_directory" -name "*.log" -type f -mtime +2 -delete echo "Log files older than 2 days deleted successfully."To use this script, replace
/path/to/log/fileswith the actual path to the directory where your log files are located. Save the script with a.shextension (e.g.,delete_old_logs.sh), make it executable using the commandchmod +x delete_old_logs.sh, and then you can run it using./delete_old_logs.shin your terminal.Please note that this script deletes log files permanently, so make sure to double-check the directory path and the files you want to delete prior to executing it.
- User
And added logs rotate
- Assistant
Certainly! Here's an updated version of the bash script that includes log rotation before deleting logs older than 2 days:
#!/bin/bash # Set the directory path and log file extension log_directory="/path/to/log/files" log_extension=".log" # Set the maximum number of log files to keep max_log_files=10 # Rotate log files cd "$log_directory" if [ -f "latest$log_extension" ]; then mv "latest$log_extension" "$(date +'%Y%m%d%H%M%S')$log_extension" fi # Find and delete log files older than 2 days find "$log_directory" -name "*$log_extension" -type f -mtime +2 -delete # Remove excess log files if the maximum number is reached log_count=$(ls -1 "$log_directory"/*$log_extension 2>/dev/null | wc -l) if [ $log_count -gt $max_log_files ]; then excess_count=$((log_count - max_log_files)) ls -1tr "$log_directory"/*$log_extension | head -n $excess_count | xargs rm fi echo "Log rotation and deletion completed successfully."Make sure to update
/path/to/log/filesand.logto the correct log directory and log file extension in the script. Additionally, set themax_log_filesvariable to control the maximum number of log files you want to keep.This script first rotates the latest log file, appending the current date and time to its name. It then finds and deletes log files older than 2 days, ensuring that only the most recent logs are retained. Finally, it checks if the number of log files exceeds the specified maximum value and removes the oldest log files to maintain that limit.
Remember to save the script with a
.shextension, make it executable usingchmod +x script_name.sh, and run it using./script_name.sh.