beispiel verbesser
This commit is contained in:
parent
90a41c130c
commit
6c64d81204
12
17.html
12
17.html
@ -196,7 +196,17 @@ $ grep -i ^${k}a${k}e${k}i${k}o${k}u${k}$ /usr/share/dict/words</code></pre>
|
||||
</p>
|
||||
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<p>zusätzliche Überlegungen:
|
||||
<ul>
|
||||
<li>gibt es bereits einen service der so heisst?</li>
|
||||
<li>existiert die datenbank?</li>
|
||||
<li>existieren die ordner?</li>
|
||||
<li>existiert das backupziel?</li>
|
||||
<li>was soll passieren wenn etwas nicht existiert?</li>
|
||||
<li>was soll passieren wenn der upload scheitert?</li>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1,5 +1,16 @@
|
||||
# install script
|
||||
|
||||
# Inhalt von backup.service
|
||||
# HERE Document https://ss64.com/bash/syntax-here.html
|
||||
SERVICE=$(cat <<EOF
|
||||
[Unit]
|
||||
Description=Tägliches Wordpress Backup
|
||||
|
||||
[Service]
|
||||
ExecStart=/bin/wp-backup.sh "$BACKUPFILE" "$BACKUPZIEL"
|
||||
EOF
|
||||
)
|
||||
|
||||
function dialog1 {
|
||||
BACKUPFILE=$(whiptail --inputbox "Backup Dateiname ohne Endung " 8 78 Name --title "Dateiname" 3>&1 1>&2 2>&3)
|
||||
check_exit_status
|
||||
@ -19,28 +30,21 @@ function check_exit_status {
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# Inhalt von backup.service
|
||||
function install_service {
|
||||
|
||||
# das HERE Document darf nicht eingerückt sein.
|
||||
SERVICE=$(cat <<EOF
|
||||
[Unit]
|
||||
Description=Tägliches Wordpress Backup
|
||||
|
||||
[Service]
|
||||
ExecStart=/bin/wp-backup.sh "$BACKUPFILE" "$BACKUPZIEL"
|
||||
EOF
|
||||
)
|
||||
|
||||
cp wp-backup.sh /bin/
|
||||
cp backup.timer /etc/systemd/system/
|
||||
echo "$SERVICE" > /etc/systemd/system/backup.service
|
||||
systemctl enable --now backup.timer
|
||||
cp wp-backup.sh /bin/ && \
|
||||
cp backup.timer /etc/systemd/system/ && \
|
||||
echo "$SERVICE" > /etc/systemd/system/backup.service && \
|
||||
systemctl enable --now backup.timer || fail
|
||||
}
|
||||
|
||||
function fail {
|
||||
echo "Fehler!!"
|
||||
exit 1
|
||||
}
|
||||
|
||||
#funktions aufrufe
|
||||
dialog1
|
||||
dialog2
|
||||
install_service
|
||||
|
||||
exit 0
|
@ -25,8 +25,6 @@ function upload {
|
||||
}
|
||||
|
||||
# Funktionsaufrufe
|
||||
dialog1
|
||||
dialog2
|
||||
db_backup
|
||||
file_backup
|
||||
upload
|
Loading…
Reference in New Issue
Block a user