-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpushweb
More file actions
executable file
·36 lines (29 loc) · 1.02 KB
/
pushweb
File metadata and controls
executable file
·36 lines (29 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash
# File: push.sh
# Brief: Used to push apache content to a remote server using rsync
# Author: nicholas_preis
# Lab 9.1: Scheduled Tasks
# Date: 1 November, 2020
#Consts
AWSHOST="ec2-18-209-61-214.compute-1.amazonaws.com"
AWSUSER="push-web"
LOCALDIR="web-content"
# Change to working directory
cd ~root/cron-lab
# Rsync
#rsync -e "ssh -i keys/pull-log" -av "${AWSUSER}@${AWSHOST}:" ${LOCALDIR}
rsync -e "ssh -i keys/push-web" -vraO --no-perms --delete --chmod=660 --chown=push-web:www-data "${LOCALDIR}/" "${AWSUSER}@${AWSHOST}":
# Write an entry to syslog
logger -t $0 "Web content pushed to ${AWSHOST}"
#Write email here
APPPW="NOTSET"
msg=$(echo -e "Web content pushed to ${AWSHOST}")
echo $msg | s-nail -v -s "XYZ Hourly Tasks" \
-S smtp-use-starttls \
-S ssl-verify-ignore \
-S smtp=smtp://smtp.gmail.com:587 \
-S from="nicholas.preis@mymail.champlain.edu" \
-S smtp-auth-user="nicholas.preis@mymail.champlain.edu" \
-S smtp-auth-password="${APPPW}" \
-S ssl-verify=ignore \
"nicholas.preis@mymail.champlain.edu" &> /dev/null