30 lines
		
	
	
	
		
			521 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable file
		
	
	
	
	
			
		
		
	
	
			30 lines
		
	
	
	
		
			521 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable file
		
	
	
	
	
#!/bin/bash
 | 
						|
MAILTO="root"
 | 
						|
MAILFROM="root@internal.heavensinferno.net"
 | 
						|
UNIT=$1
 | 
						|
 | 
						|
EXTRA=""
 | 
						|
for e in "${@:2}"; do
 | 
						|
  EXTRA+="$e"$'\n'
 | 
						|
done
 | 
						|
 | 
						|
UNITSTATUS=$(systemctl status $UNIT)
 | 
						|
 | 
						|
sendmail $MAILTO <<EOF
 | 
						|
From:$MAILFROM
 | 
						|
To: $MAILTO
 | 
						|
Subject:[systemd timer] Status mail for unit: $UNIT
 | 
						|
Content-Transfer-Encoding: 8bit
 | 
						|
Content-Type: text/plain; charset=UTF-8
 | 
						|
X-Priority: 1 (High)
 | 
						|
X-MSMail-Priority: High
 | 
						|
Importance: High
 | 
						|
 | 
						|
Status report for unit: $UNIT
 | 
						|
$EXTRA
 | 
						|
 | 
						|
$UNITSTATUS
 | 
						|
EOF
 | 
						|
 | 
						|
echo -e "Status mail sent to: $MAILTO for unit: $UNIT"
 | 
						|
 |