Advertisement
sergio_educacionit

backup_logger.sh

Jan 21st, 2023 (edited)
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.36 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. func_logger () {
  4.  
  5.     # Uso:
  6.     # func_logger "severity" "mark" "message"
  7.  
  8.     local sty="$1"
  9.     local mrk="$2"
  10.     local msg="$3"
  11.  
  12.     logger -t "$mrk" -p user.$sty "$msg" || exit 1
  13.  
  14. }
  15.  
  16.  
  17. func_logger info "Backup" "Inicia"
  18.  
  19.  
  20. rsync -av /var/www /tmp/backup || func_logger err "Backup" "terminado con exit $?"
  21.  
  22. func_logger info "Backup" "Finalizado"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement