|
@@ -40,58 +40,141 @@ if [ ! "$1" ]; then
|
40
|
40
|
fi
|
41
|
41
|
|
42
|
42
|
if [[ "$1" == "on" || "$1" == "On" || "$1" == "ON" ]]; then
|
43
|
|
- if [ -d /etc/nginx ]; then
|
44
|
|
- for filename in /etc/nginx/sites-available/* ; do
|
45
|
|
- filename_domain=$(echo "$filename" | awk -F '/' '{print $5}')
|
46
|
|
- sed -i "s|access_log.*|access_log /var/log/nginx/$filename_domain.access.log;|g" $filename
|
47
|
|
- sed -i "s|error_log.*|error_log /var/log/nginx/$filename_domain.err.log $WEBSERVER_LOG_LEVEL;|g" $filename
|
48
|
|
- done
|
49
|
|
- fi
|
50
|
|
- if [ -f /etc/init.d/spamassassin ]; then
|
51
|
|
- sed -i 's|DOPTIONS="-s null -d --pidfile=$PIDFILE"|DOPTIONS="-d --pidfile=$PIDFILE"|g' /etc/init.d/spamassassin
|
52
|
|
- fi
|
53
|
|
- if [ -d /etc/prosody ]; then
|
54
|
|
- sed -i 's|info = "/dev/null";|info = "/var/log/prosody/prosody.log";|g' /etc/prosody/prosody.cfg.lua
|
55
|
|
- sed -i 's|error = "/dev/null";|error = "/var/log/prosody/prosody.err";|g' /etc/prosody/prosody.cfg.lua
|
56
|
|
- fi
|
57
|
|
- if [ -d /etc/exim4 ]; then
|
58
|
|
- sed -i 's|log_selector =.*|log_selector = MAIN_LOG_SELECTOR|g' /etc/exim4/conf.d/main/90_exim4-config_log_selector
|
59
|
|
- fi
|
|
43
|
+ if [ -d /etc/tor ]; then
|
|
44
|
+ sed -i 's|#Log notice file.*|Log notice file /var/log/tor.log|g' /etc/tor/torrc
|
|
45
|
+ sed -i 's|Log notice file.*|Log notice file /var/log/tor.log|g' /etc/tor/torrc
|
|
46
|
+ fi
|
|
47
|
+ if [ -f /etc/mumble-server.ini ]; then
|
|
48
|
+ sed -i 's|logfile=.*|logfile=/var/log/mumble-server.log|g' /etc/mumble-server.ini
|
|
49
|
+ fi
|
|
50
|
+ if [ -f /etc/php5/fpm/php-fpm.conf ]; then
|
|
51
|
+ sed -i 's|error_log =.*|error_log = /var/log/php5-fpm.log|g' /etc/php5/fpm/php-fpm.conf
|
|
52
|
+ fi
|
|
53
|
+ if [ -d /etc/nginx ]; then
|
|
54
|
+ if [ ! -d /var/log/nginx ]; then
|
|
55
|
+ mkdir /var/log/nginx
|
|
56
|
+ fi
|
|
57
|
+ for filename in /etc/nginx/sites-available/* ; do
|
|
58
|
+ filename_domain=$(echo "$filename" | awk -F '/' '{print $5}')
|
|
59
|
+ sed -i "s|access_log.*|access_log /var/log/nginx/$filename_domain.access.log;|g" $filename
|
|
60
|
+ sed -i "s|error_log.*|error_log /var/log/nginx/$filename_domain.err.log $WEBSERVER_LOG_LEVEL;|g" $filename
|
|
61
|
+ done
|
|
62
|
+ fi
|
|
63
|
+ if [ -f /etc/init.d/spamassassin ]; then
|
|
64
|
+ sed -i 's|DOPTIONS="-s null -d --pidfile=$PIDFILE"|DOPTIONS="-d --pidfile=$PIDFILE"|g' /etc/init.d/spamassassin
|
|
65
|
+ fi
|
|
66
|
+ if [ -d /etc/prosody ]; then
|
|
67
|
+ if [ ! -d /var/log/prosody ]; then
|
|
68
|
+ mkdir /var/log/prosody
|
|
69
|
+ fi
|
|
70
|
+ sed -i 's|info = "/dev/null";|info = "/var/log/prosody/prosody.log";|g' /etc/prosody/prosody.cfg.lua
|
|
71
|
+ sed -i 's|error = "/dev/null";|error = "/var/log/prosody/prosody.err";|g' /etc/prosody/prosody.cfg.lua
|
|
72
|
+ fi
|
|
73
|
+ if [ -d /etc/exim4 ]; then
|
|
74
|
+ if [ ! -d /var/log/exim4 ]; then
|
|
75
|
+ mkdir /var/log/exim4
|
|
76
|
+ fi
|
|
77
|
+ sed -i 's|log_selector =.*|log_selector = MAIN_LOG_SELECTOR|g' /etc/exim4/conf.d/main/90_exim4-config_log_selector
|
|
78
|
+ fi
|
|
79
|
+ if [ -f /etc/dovecot/dovecot.conf ]; then
|
|
80
|
+ sed -i 's|log_path =.*|log_path = /var/log/dovecot.log|g' /etc/dovecot/dovecot.conf
|
|
81
|
+ sed -i 's|info_log_path =.*|info_log_path = /var/log/dovecot-info.log|g' /etc/dovecot/dovecot.conf
|
|
82
|
+ sed -i 's|debug_log_path =.*|debug_log_path = /var/log/dovecot-debug.log|g' /etc/dovecot/dovecot.conf
|
|
83
|
+ fi
|
|
84
|
+ if [ -d /etc/mysql ]; then
|
|
85
|
+ if [ ! -d /var/log/mysql ]; then
|
|
86
|
+ mkdir /var/log/mysql
|
|
87
|
+ fi
|
|
88
|
+ sed -i 's|log_error =.*|log_error = /var/log/mysql/error.log|g' /etc/mysql/my.cnf
|
|
89
|
+ fi
|
60
|
90
|
else
|
61
|
|
- if [ -d /etc/nginx ]; then
|
62
|
|
- for filename in /etc/nginx/sites-available/* ; do
|
63
|
|
- sed -i 's|access_log.*|access_log /dev/null;|g' $filename
|
64
|
|
- sed -i 's|warn_log.*|warn_log /dev/null;|g' $filename
|
65
|
|
- sed -i 's|error_log.*|error_log /dev/null;|g' $filename
|
66
|
|
- done
|
67
|
|
- shred -zu /var/log/nginx/*
|
68
|
|
- fi
|
69
|
|
- if [ -f /etc/init.d/spamassassin ]; then
|
70
|
|
- sed -i 's|DOPTIONS="-d --pidfile=$PIDFILE"|DOPTIONS="-s null -d --pidfile=$PIDFILE"|g' /etc/init.d/spamassassin
|
71
|
|
- fi
|
72
|
|
- if [ -d /etc/prosody ]; then
|
73
|
|
- sed -i 's|info = "/var/log/prosody/prosody.log";|info = "/dev/null";|g' /etc/prosody/prosody.cfg.lua
|
74
|
|
- sed -i 's|error = "/var/log/prosody/prosody.err";|error = "/dev/null";|g' /etc/prosody/prosody.cfg.lua
|
75
|
|
- shred -zu /var/log/prosody/prosody.log
|
76
|
|
- shred -zu /var/log/prosody/prosody.err
|
77
|
|
- fi
|
78
|
|
- if [ -d /etc/exim4 ]; then
|
79
|
|
- sed -i 's|log_selector =.*|log_selector = -all|g' /etc/exim4/conf.d/main/90_exim4-config_log_selector
|
80
|
|
- fi
|
|
91
|
+ if [ -d /etc/tor ]; then
|
|
92
|
+ sed -i 's|#Log notice file.*|Log notice file /dev/null|g' /etc/tor/torrc
|
|
93
|
+ sed -i 's|Log notice file.*|Log notice file /dev/null|g' /etc/tor/torrc
|
|
94
|
+ if [ -d /var/log/tor ]; then
|
|
95
|
+ shred -zu /var/log/tor/*
|
|
96
|
+ rm -rf /var/log/tor
|
|
97
|
+ fi
|
|
98
|
+ fi
|
|
99
|
+ if [ -f /etc/mumble-server.ini ]; then
|
|
100
|
+ sed -i 's|logfile=.*|logfile=/dev/null|g' /etc/mumble-server.ini
|
|
101
|
+ if [ -d /var/log/mumble-server ]; then
|
|
102
|
+ shred -zu /var/log/mumble-server/*
|
|
103
|
+ rm -rf /var/log/mumble-server
|
|
104
|
+ fi
|
|
105
|
+ fi
|
|
106
|
+ if [ -d /var/log/radicale ]; then
|
|
107
|
+ shred -zu /var/log/radicale/*
|
|
108
|
+ rm -rf /var/log/radicale
|
|
109
|
+ fi
|
|
110
|
+ if [ -f /etc/php5/fpm/php-fpm.conf ]; then
|
|
111
|
+ sed -i 's|error_log =.*|error_log = /dev/null|g' /etc/php5/fpm/php-fpm.conf
|
|
112
|
+ fi
|
|
113
|
+ if [ -d /etc/nginx ]; then
|
|
114
|
+ for filename in /etc/nginx/sites-available/* ; do
|
|
115
|
+ sed -i 's|access_log.*|access_log /dev/null;|g' $filename
|
|
116
|
+ sed -i 's|warn_log.*|warn_log /dev/null;|g' $filename
|
|
117
|
+ sed -i 's|error_log.*|error_log /dev/null;|g' $filename
|
|
118
|
+ done
|
|
119
|
+ shred -zu /var/log/nginx/*
|
|
120
|
+ fi
|
|
121
|
+ if [ -f /etc/init.d/spamassassin ]; then
|
|
122
|
+ sed -i 's|DOPTIONS="-d --pidfile=$PIDFILE"|DOPTIONS="-s null -d --pidfile=$PIDFILE"|g' /etc/init.d/spamassassin
|
|
123
|
+ fi
|
|
124
|
+ if [ -d /etc/prosody ]; then
|
|
125
|
+ sed -i 's|info = "/var/log/prosody/prosody.log";|info = "/dev/null";|g' /etc/prosody/prosody.cfg.lua
|
|
126
|
+ sed -i 's|error = "/var/log/prosody/prosody.err";|error = "/dev/null";|g' /etc/prosody/prosody.cfg.lua
|
|
127
|
+ shred -zu /var/log/prosody/prosody.log
|
|
128
|
+ shred -zu /var/log/prosody/prosody.err
|
|
129
|
+ fi
|
|
130
|
+ if [ -d /etc/exim4 ]; then
|
|
131
|
+ sed -i 's|log_selector =.*|log_selector = -all|g' /etc/exim4/conf.d/main/90_exim4-config_log_selector
|
|
132
|
+ shred -zu /var/log/exim4/*
|
|
133
|
+ fi
|
|
134
|
+ if [ -f /etc/dovecot/dovecot.conf ]; then
|
|
135
|
+ sed -i 's|log_path =.*|log_path = /dev/null|g' /etc/dovecot/dovecot.conf
|
|
136
|
+ sed -i 's|info_log_path =.*|info_log_path = /dev/null|g' /etc/dovecot/dovecot.conf
|
|
137
|
+ sed -i 's|debug_log_path =.*|debug_log_path = /dev/null|g' /etc/dovecot/dovecot.conf
|
|
138
|
+ shred -zu /var/log/mail.*
|
|
139
|
+ fi
|
|
140
|
+ if [ -d /etc/mysql ]; then
|
|
141
|
+ if [ -d /var/log/mysql ]; then
|
|
142
|
+ shred -zu /var/log/mysql/*
|
|
143
|
+ fi
|
|
144
|
+ if [ -f /var/log/mysql.err ]; then
|
|
145
|
+ shred -zu /var/log/mysql.err
|
|
146
|
+ fi
|
|
147
|
+ if [ -f /var/log/mysql.log ]; then
|
|
148
|
+ shred -zu /var/log/mysql.log
|
|
149
|
+ fi
|
|
150
|
+ sed -i 's|log_error =.*|log_error = /dev/null|g' /etc/mysql/my.cnf
|
|
151
|
+ fi
|
81
|
152
|
fi
|
82
|
153
|
|
83
|
154
|
if [ -d /etc/nginx ]; then
|
84
|
|
- service php5-fpm restart
|
85
|
|
- service nginx restart
|
|
155
|
+ systemctl restart php5-fpm
|
|
156
|
+ systemctl restart nginx
|
86
|
157
|
fi
|
87
|
158
|
if [ -f /etc/init.d/spamassassin ]; then
|
88
|
|
- service spamassassin restart
|
|
159
|
+ systemctl restart spamassassin
|
89
|
160
|
fi
|
90
|
161
|
if [ -d /etc/prosody ]; then
|
91
|
|
- service prosody restart
|
|
162
|
+ systemctl restart prosody
|
92
|
163
|
fi
|
93
|
164
|
if [ -d /etc/exim4 ]; then
|
94
|
|
- service exim4 restart
|
|
165
|
+ systemctl restart exim4
|
|
166
|
+fi
|
|
167
|
+if [ -d /etc/dovecot ]; then
|
|
168
|
+ systemctl restart dovecot
|
|
169
|
+fi
|
|
170
|
+if [ -d /etc/tor ]; then
|
|
171
|
+ systemctl reload tor
|
|
172
|
+fi
|
|
173
|
+if [ -f /etc/mumble-server.ini ]; then
|
|
174
|
+ systemctl restart mumble-server
|
|
175
|
+fi
|
|
176
|
+if [ -d /var/www/radicale ]; then
|
|
177
|
+ systemctl restart radicale
|
95
|
178
|
fi
|
96
|
179
|
|
97
|
180
|
exit 0
|