Last active
January 3, 2020 21:59
-
-
Save jooray/c7583ebe6666bd948c18ce8ae07446fb to your computer and use it in GitHub Desktop.
optimize images
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
dirs=( "/home/web1" "/home/web2" ) | |
# run without "-mtime -3" for the first time, then put into cron | |
find "${dirs[@]}" -mtime -3 -name \*.png -exec optipng -preserve {} \; | |
find "${dirs[@]}" -mtime -3 \( -name \*.jpg -or -name \*.jpeg \) -exec jpegoptim {} \; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment