Ubuntu Pastebin

Paste from Thomas Ward at Tue, 3 May 2016 21:10:49 +0000

Download as text
 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
#!/usr/bin/env bash

# Script Author: Thomas Ward
# Script Title: Restart SSH, and HTTPds
#
# This script pushes out to all systems via Landscape.
# This script will force a restart of SSHd, and Apache or Nginx HTTPds
#
# This is to be run after security updates affecting OpenSSL.

if [ "$(lsb_release -r -s)" -eq "16.04" ] || [ "$(lsb_release -r -s)" -eq "15.10" ]; then
    systemctl restart ssh
    if [ -e /etc/init.d/apache2 ]; then
        systemctl restart apache2
    fi
    if [ -e /etc/init.d/nginx ]; then
        systemctl restart nginx
    fi 
    
else
    service ssh restart
    if [ -e /etc/init.d/apache2 ]; then
        systemctl restart apache2
    fi
    if [ -e /etc/init.d/nginx ]; then
        systemctl restart nginx
    fi

fi
Download as text