sergio_educacionit

archivador de logs

May 11th, 2026
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. #!/bin/bash
  2. # El shebang es la primera línea de un script que indica
  3. # qué intérprete debe ejecutarlo.
  4. # #!/bin/python #!/bin/env ruby #/usr/bin/php
  5.  
  6. fecha=$(date +%s)
  7.  
  8.  
  9. origen="/var/log/cloud-init.log"
  10.  
  11. destino="$(basename $origen).${fecha}"
  12.  
  13. cp $origen ${HOME}/${destino}
  14.  
  15.  
  16. gzip ${HOME}/${destino}
  17.  
  18. ls ${HOME}/*.gz -1 | nl
Advertisement
Add Comment
Please, Sign In to add comment