This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| computing:servicebuilder [2026/09/05 23:25] – oemb1905 | computing:servicebuilder [2026/09/05 23:33] (current) – oemb1905 | ||
|---|---|---|---|
| Line 26: | Line 26: | ||
| </ | </ | ||
| + | ====== Apache Restart ====== | ||
| + | ~~NOTOC~~ | ||
| + | < | ||
| + | cat > / | ||
| + | #!/bin/sh | ||
| + | #functions | ||
| + | RESTART="/ | ||
| + | SERVICE=" | ||
| + | LOGFILE="/ | ||
| + | #check for the word dead in the service output from systemctl | ||
| + | if | ||
| + | systemctl status apache2.service | grep ' | ||
| + | then | ||
| + | echo " | ||
| + | $RESTART >> $LOGFILE | ||
| + | mail -s " | ||
| + | else | ||
| + | exit | ||
| + | fi | ||
| + | EOF | ||
| + | chmod 750 / | ||
| + | </ | ||
| + | |||
| + | ====== Mariadb Restart ===== | ||
| + | |||
| + | < | ||
| + | cat > / | ||
| + | #!/bin/sh | ||
| + | #functions | ||
| + | RESTART="/ | ||
| + | STATUS="/ | ||
| + | SERVICE=" | ||
| + | LOGFILE="/ | ||
| + | #check for the word dead in the service output from systemctl | ||
| + | if | ||
| + | $STATUS | grep " | ||
| + | then | ||
| + | echo " | ||
| + | $RESTART >> $LOGFILE | ||
| + | mail -s " | ||
| + | else | ||
| + | exit | ||
| + | fi | ||
| + | EOF | ||
| + | chmod 750 / | ||
| + | </ | ||
| + | |||
| + | ====== Fail2Ban Restart ===== | ||
| + | < | ||
| + | cat > / | ||
| + | #!/bin/sh | ||
| + | #functions | ||
| + | RESTART="/ | ||
| + | SERVICE=" | ||
| + | LOGFILE="/ | ||
| + | #check for the word dead in the service output from systemctl | ||
| + | if | ||
| + | systemctl status fail2ban.service | grep ' | ||
| + | then | ||
| + | echo " | ||
| + | $RESTART >> $LOGFILE | ||
| + | mail -s " | ||
| + | else | ||
| + | exit | ||
| + | fi | ||
| + | EOF | ||
| + | chmod 750 / | ||
| + | </ | ||
| + | |||
| + | ====== Qemu Agent Restart ===== | ||
| + | < | ||
| + | cat > / | ||
| + | #!/bin/sh | ||
| + | #functions | ||
| + | RESTART="/ | ||
| + | SERVICE=" | ||
| + | LOGFILE="/ | ||
| + | #check for the word dead in the service output from systemctl | ||
| + | if | ||
| + | systemctl status qemu-guest-agent.service | grep ' | ||
| + | then | ||
| + | echo " | ||
| + | $RESTART >> $LOGFILE | ||
| + | mail -s " | ||
| + | else | ||
| + | exit | ||
| + | fi | ||
| + | EOF | ||
| + | chmod 750 / | ||
| + | </ | ||
| + | |||
| + | ====== Amavis Restart ===== | ||
| + | < | ||
| + | cat > / | ||
| + | #!/bin/sh | ||
| + | #functions | ||
| + | RESTART="/ | ||
| + | SERVICE=" | ||
| + | LOGFILE="/ | ||
| + | #check for the word dead in the service output from systemctl | ||
| + | if | ||
| + | systemctl status $SERVICE | grep ' | ||
| + | then | ||
| + | echo " | ||
| + | $RESTART >> $LOGFILE | ||
| + | mail -s " | ||
| + | rm $LOGFILE | ||
| + | else | ||
| + | exit | ||
| + | fi | ||
| + | EOF | ||
| + | chmod 750 / | ||
| + | </ | ||
| + | |||
| + | ====== ClamAV Restart ===== | ||
| + | < | ||
| + | cat > / | ||
| + | #!/bin/sh | ||
| + | #functions | ||
| + | RESTART="/ | ||
| + | SERVICE=" | ||
| + | LOGFILE="/ | ||
| + | #check for the word dead in the service output from systemctl | ||
| + | if | ||
| + | systemctl status $SERVICE | grep ' | ||
| + | then | ||
| + | echo " | ||
| + | $RESTART >> $LOGFILE | ||
| + | mail -s " | ||
| + | rm $LOGFILE | ||
| + | else | ||
| + | exit | ||
| + | fi | ||
| + | EOF | ||
| + | chmod 750 / | ||
| + | </ | ||
| + | |||
| + | ====== Dovecot Restart ===== | ||
| + | < | ||
| + | cat > / | ||
| + | #!/bin/sh | ||
| + | #functions | ||
| + | RESTART="/ | ||
| + | SERVICE=" | ||
| + | LOGFILE="/ | ||
| + | #check for the word dead in the service output from systemctl | ||
| + | if | ||
| + | # | ||
| + | systemctl status $SERVICE | grep ' | ||
| + | then | ||
| + | echo " | ||
| + | $RESTART >> $LOGFILE | ||
| + | mail -s " | ||
| + | rm $LOGFILE | ||
| + | else | ||
| + | exit | ||
| + | fi | ||
| + | EOF | ||
| + | chmod 750 / | ||
| + | </ | ||
| + | |||
| + | ====== Postfix Restart ===== | ||
| + | < | ||
| + | cat > / | ||
| + | #!/bin/sh | ||
| + | #functions | ||
| + | RESTART="/ | ||
| + | SERVICE=" | ||
| + | LOGFILE="/ | ||
| + | #check for the word dead in the service output from systemctl | ||
| + | if | ||
| + | systemctl is-active $SERVICE | grep ' | ||
| + | then | ||
| + | echo " | ||
| + | $RESTART >> $LOGFILE | ||
| + | mail -s " | ||
| + | rm $LOGFILE | ||
| + | else | ||
| + | exit | ||
| + | fi | ||
| + | EOF | ||
| + | chmod 750 / | ||
| + | </ | ||
| + | |||
| + | ====== Spam Assassin Restart ===== | ||
| + | < | ||
| + | cat > / | ||
| + | #!/bin/sh | ||
| + | #functions | ||
| + | RESTART="/ | ||
| + | SERVICE=" | ||
| + | LOGFILE="/ | ||
| + | #check for the word dead in the service output from systemctl | ||
| + | if | ||
| + | systemctl status $SERVICE | grep ' | ||
| + | then | ||
| + | echo " | ||
| + | $RESTART >> $LOGFILE | ||
| + | mail -s " | ||
| + | rm $LOGFILE | ||
| + | else | ||
| + | exit | ||
| + | fi | ||
| + | EOF | ||
| + | chmod 750 / | ||
| + | </ | ||
| + | |||
| + | ====== MariaDB Dump ===== | ||
| + | < | ||
| + | cat > / | ||
| + | DATE=`date +" | ||
| + | START1=" | ||
| + | LOGFILE="/ | ||
| + | / | ||
| + | --defaults-extra-file=/ | ||
| + | --add-drop-database \ | ||
| + | --all-databases | ||
| + | --allow-keywords | ||
| + | --comments | ||
| + | --complete-insert | ||
| + | --lock-all-tables | ||
| + | --skip-dump-date | ||
| + | --events | ||
| + | --flush-logs | ||
| + | --flush-privileges | ||
| + | --hex-blob | ||
| + | --opt \ | ||
| + | --routines | ||
| + | > / | ||
| + | END1=" | ||
| + | DURATION1=$[ ${END1} - ${START1} ] | ||
| + | MINUTES=$[ ${DURATION1} / 60 ] | ||
| + | echo " | ||
| + | mail -s " | ||
| + | rm $LOGFILE | ||
| + | EOF | ||
| + | chmod 750 / | ||
| + | </ | ||
| + | |||
| + | --- // | ||