Skip to content
Snippets Groups Projects
Select Git revision
  • c65230b37e99064535815f9fe4dad4af7de539f5
  • master default protected
  • dev
3 results

posts.php

Blame
  • inc.sh 609 B
    #!/bin/bash
    
    DIR=$(realpath $(dirname $0))
    source $DIR/.env
    
    # Exit the script and sendmail
    # $1 : exit code
    # $2 : message
    leave(){
            subject="[ `hostname` ] Backup"
            if [ $1 -eq 0 ]
            then
                    subject="$subject successful"
            else
                    subject="$subject failed"
            fi
    cat << EOF | /usr/sbin/sendmail -t root
    Subject: $subject
    
    The backup on `hostname` ended with code $1.
    
    $2
    
    For more information see /var/log/bckp.log
    
    Best regards,
    
    EOF
            exit $1
    }
    
    if [ `whoami` != "root" ]
    then
            echo "this script must be run as root"
            exit 1
    fi