086cc7570c45928d6366efc9d4015fdab6811202
[apache2-cn.git] / debian / postinst
1 #!/bin/sh
2
3 set -e
4
5 [ "$DEBIAN_SCRIPT_DEBUG" ] && set -vx
6
7 # Source debconf library.
8 . /usr/share/debconf/confmodule
9
10 case "$1" in
11         configure)
12                 # continue below
13                 ;;
14
15         abort-upgrade|abort-remove|abort-deconfigure)
16                 exit 0
17                 ;;
18
19         *)
20                 echo "postinst called with unknown argument \`$1'" >&2
21                 exit 0
22                 ;;
23 esac
24
25
26 # Include CARNet functions.
27 . /usr/share/carnet-tools/functions.sh
28
29 PKG="apache2-cn"
30 VERSION="2.2-1"
31 CONFDIR="/etc/apache2"
32 CONFDIROLD="/etc/apache"
33 CONF="$CONFDIR/apache2.conf"
34 CONFOLD="$CONFDIROLD/httpd.conf"
35 A2MODEDIR="$CONFDIR/mods-enabled"
36 PORTCONF="$CONFDIR/ports.conf"
37 A2CNDIR=/usr/share/apache2-cn
38 TMPLDIR=$A2CNDIR/templates
39 CERTDIR=/etc/ssl/certs
40 A2PHPINI="/etc/php4/apache2/php.ini"
41
42 HOST=$(hostname)
43 FQDN=$(hostname --fqdn)
44 WEBMASTER="webmaster@$FQDN"
45 DOMAIN=$(hostname -d)
46 BACKUPDIR="/var/backups/apache2-cn"
47
48 backup_done=0
49 need_restart=0
50 apache2_sslcert=0
51 apache2_sslcf=
52 apache2_sslckf=
53 apache2_sslccf=
54 has_vhosts=0
55 temp_files=
56 has_listen_ssl=0
57 listen_ssl_mask=
58
59
60 # cleanup()
61 #
62 #   Cleanup all temp files.
63 #
64 cleanup () {
65
66         if [ -n "$temp_files" ]; then
67                 for item in $temp_files; do
68                         if [ -e "$item" ]; then
69                                 rm -f $item
70                         fi
71                 done
72         fi
73 }
74
75 # tag_conf()
76 #
77 #   Add CARNet package info lines to config's header.
78 #
79 tag_conf () {
80         
81         local conf_file
82         conf_file="$1"
83         
84         if [ -e "$conf_file" ]; then
85         
86                 cat >> $conf_file <<EOF
87 ## Begin - Generated by CARNet package apache2-cn
88 #
89 #  REMOVE this whole block if you DON'T WANT apache2-cn
90 #  to edit your configuration file.
91 #
92 ## End - Generated by CARNet package apache2-cn
93 EOF
94         fi
95 }
96
97 # chk_conf_tag ()
98 #
99 #   Check if configuration file has CARNet package info lines.
100 #   return:  $RET => 0 - tagged
101 #                    1 - not tagged or file does not exists
102 #                    2 - file exists, but it is not tagged
103 #
104 chk_conf_tag () {
105
106         local conf_file
107         conf_file="$1"
108         RET=1
109         
110         if [ -f "$conf_file" ]; then
111                 if egrep -q "^## Begin - Generated by CARNet package apache2-cn$" "$conf_file"; then
112                         RET=0
113                 else
114                         RET=2
115                 fi
116         fi
117 }
118
119 # conf_log_fix ()
120 #
121 #   Check CustomLog, ErrorLog and TransferLog paths - /var/log/apache/ is replaced
122 #   with /var/log/apache2/.
123 #
124 conf_log_fix () {
125
126         local conf_file out
127         conf_file="$1"
128
129         if [ -f "$conf_file" ]; then
130         
131             if egrep -iq '^[[:space:]]*(Error|Custom|Transfer)Log[[:space:]]*\/var\/log\/apache\/' "$conf_file"; then
132             
133                 out=$(mktemp ${conf_file}.XXXXXX)
134                 temp_files="${temp_files} ${out}"
135             
136                 sed 's/\(^[[:space:]]*\(Error\|Custom\|Transfer\)Log[[:space:]]*\)\/var\/log\/apache\//\1\/var\/log\/apache2\//I' \
137                     $conf_file > $out
138                 mv $out $conf_file
139             fi
140             
141             # Be sure..
142             chmod 644 $conf_file
143         fi
144 }
145
146 # generate_ssl()
147 #
148 #   Generate Apache2 web server SSL certificate.
149 #
150 generate_ssl () {
151
152         generate_ssl_output=$($A2CNDIR/carnet-generate-ssl ignore "$FQDN" "$WEBMASTER" "$DOMAIN" 2> /dev/null)
153         cp_echo "$generate_ssl_output"
154         need_restart=1
155 }
156
157 # listen_ssl()
158 #
159 #   Check if port 443 is configured in ports.conf file.
160 #
161 listen_ssl() {
162
163         if [ ! -f "$PORTCONF" ] || ! egrep -iq "^[[:space:]]*Listen[[:space:]]*.*443$" "$PORTCONF"; then
164         
165                 cp_echo "CN: Enabling SSL port (443) for Apache2 web server."
166
167                 out=$(mktemp ${PORTCONF}.XXXXXX)
168                 
169                 if [ -f "$PORTCONF" ]; then
170                         cp $PORTCONF $out
171                 fi
172                 
173                 echo "Listen 443" >> $out
174                 cp_mv $out $PORTCONF
175                 chmod 644 $PORTCONF
176                 
177                 need_restart=1
178                 temp_files="${temp_files} ${out}"
179         fi
180 }
181
182 # install_conf()
183 #
184 #   Install specified Apache2 configuration file.
185 #
186 install_conf() {
187
188         conftmpl="$A2CNDIR/$1.conf"
189         conf="$CONFDIR/conf.d/$2.conf"
190
191         if [ ! -e "$conf" ]; then
192         
193                 cp_echo "CN: Enabling CARNet specific configuration."
194                 cp "$conftmpl" "$conf"
195                 
196                 need_restart=1
197         else
198                 cp_echo "CN: $conf already exists, left untouched." 1>&2
199         fi
200 }
201
202 # install_vhost()
203 #
204 #   Install specified VirtualHost for Apache2 web server.
205 #
206 #   Invocation:
207 #
208 #   install_vhost [-nvh] [-d] [-s docroot_symlink_dest] template site site-enabled-symlink
209 #
210 #     -nvh - add NameVirtualHost
211 #     -d   - mkdir DocumentRoot
212 #     -r   - set DocumentRoot
213 #     -n   - set ServerName
214 #     -s X - symlink DocumentRoot to X (all in /var/www)
215 #
216 #   site - name of file in sites-available, host part of ServerName unless -r or -n is used
217 #   site-enabled-symlink - name of symlink in sites-enabled
218 #
219 install_vhost() {
220
221         add_namevirthost=
222         mkdir_docroot=
223         symlink_docroot=
224         docroot=
225         vhostname=
226   
227         while echo "x$1" | grep -q '^x-'; do
228             case "$1" in
229                 -nvh)
230                     add_namevirthost=1
231                     shift
232                     ;;
233                 -d)
234                     mkdir_docroot=1
235                     shift
236                     ;;
237                 -s)
238                     shift
239                     symlink_docroot="$1"
240                     shift
241                     ;;
242                 -r)
243                     shift
244                     docroot="$1"
245                     if ! echo "$docroot" | grep -q /; then
246                             docroot="/var/www/$docroot"
247                     fi
248                     shift
249                     ;;
250                 -n)
251                     shift
252                     vhostname="$1"
253                     shift
254                     ;;
255             esac
256         done
257
258         vhosttmpl="$1.template"
259         vhost="$2"
260         venabled="$3"
261         [ -z "$vhostname" ] && vhostname=$(echo "$vhost"| awk -F. '{print $1}')
262         force_vhost=
263
264         vhostdir=$CONFDIR/sites-available
265         venabledir=$CONFDIR/sites-enabled
266
267         if [ ! -e "$TMPLDIR/${vhosttmpl}" ]; then
268                 echo "E: vhost template ${vhosttmpl} not found in $TMPLDIR!" 1>&2
269                 exit 2
270         fi
271
272         [ -z "$docroot" ] && docroot="/var/www/$vhostname.$DOMAIN"
273   
274         # if we were broken mid-installation, force
275         if [ ! -e "$docroot" -a \( -n "$mkdir_docroot" -o -n "$symlink_docroot" \) ]; then
276                 force_vhost=1
277         fi
278   
279         # add vhost if either of these is true
280         # - adding is forced OR
281         # - it doesn't exist
282         #
283         if [ -n "$force_vhost" -o \( ! -e "$vhostdir/$vhost" -a ! -e "$venabledir/$venabled" \) ]; then
284         
285                 cp_echo "CN: Adding $vhost VirtualHost."
286                 out=$(mktemp $vhostdir/$vhost.XXXXXX)
287                 temp_files="${temp_files} ${out}"
288                 
289                 # CARNet header.
290                 tag_conf "$out"
291
292                 if [ "$add_namevirthost" ]; then
293                         nvh=$(awk -F'[ >]' '/^<VirtualHost/ {print $2}' $TMPLDIR/$vhosttmpl |\
294                             sed "s/IPADDR/$MYIP/g")
295                         echo "NameVirtualHost $nvh" >> $out
296                 fi
297     
298                 sed "s/HOST/$vhostname/g; s/DOMAIN/$DOMAIN/g;
299                      s#DOCROOT#$docroot#g; s/IPADDR/$MYIP/g" < $TMPLDIR/$vhosttmpl >> $out
300                 cp_mv $out $vhostdir/$vhost
301                 chmod 644 $vhostdir/$vhost
302                 ln -fs ../sites-available/$vhost $venabledir/$venabled    
303     
304                 if [ -n "$mkdir_docroot" -a ! -d "$docroot" ]; then
305                         mkdir "$docroot"
306                         echo '<html><body><h1>Radi!</h1></body></html>' > "$docroot/index.html"
307                 elif [ -n "$symlink_docroot" ]; then
308                         ln -fs "$symlink_docroot" "$docroot"
309                 fi
310
311                 need_restart=1
312         fi
313 }
314
315
316 # Set trap for deleting all temp files.
317 #
318 trap cleanup 0 1 2 15
319
320
321 # Make sure that monit conf for Apache is disabled.
322 #
323 if [ -f "/etc/monit.d/apache1.conf" ]; then
324         mv /etc/monit.d/apache1.conf /etc/monit.d/apache1.conf.disabled
325         pkill -9 -f /usr/sbin/monit || true
326 fi
327
328
329 # Make sure Apache is NOT running.
330 #
331 if [ -x /usr/sbin/invoke-rc.d ]; then
332         [ -x /usr/sbin/apache ] && invoke-rc.d apache stop || true
333         pkill -9 -f /usr/sbin/apache || true
334 else
335         [ -x /etc/init.d/apache ] && /etc/init.d/apache stop || true
336 fi
337
338
339 # Backup all configuration located in /etc/apache2/conf.d/ and
340 # /etc/apache2/sites-available/ directories.
341 #
342 if [ -e "$CONF" ]; then
343         cp_echo "CN: Doing backup for $CONF"
344         cp_backup_conffile -d $BACKUPDIR -p $CONF
345         backup_done=1
346 fi
347 if [ -d "$CONFDIR/conf.d" ] && [ -n "$(ls ${CONFDIR}/conf.d/)" ]; then
348         cp_echo "CN: Doing backup for all files in /etc/apache2/conf.d/"
349         for file in /etc/apache2/conf.d/*; do
350             if [ -z "$(echo $file | egrep '^/.*~')" ]; then
351                 cp_backup_conffile -d $BACKUPDIR -p $file
352             fi
353         done
354         backup_done=1
355 fi
356 if [ -d "$CONFDIR/sites-available" ] && [ -n "$(ls ${CONFDIR}/sites-available/)" ]; then
357         cp_echo "CN: Doing backup for all files in /etc/apache2/sites-available/"
358         for file in /etc/apache2/sites-available/*; do
359             if [ -z "$(echo $file | egrep '^/.*~')" ]; then
360                 cp_backup_conffile -d $BACKUPDIR -p $file
361             fi
362         done
363         backup_done=1
364 fi
365 if [ $backup_done -eq 1 ]; then
366         cp_echo "CN: Backup is located in directory: $BACKUPDIR/"
367 fi
368
369
370 # Enable Apache2 web server modules (cgi, rewrite, userdir, suexec, php4, ssl).
371 #
372 if [ -e "$CONF" ]; then
373
374         if [ ! -e "$A2MODEDIR/cgi.load" ]; then
375                 cp_echo "CN: Enabling CGI module for Apache2 web server."
376                 a2enmod cgi >/dev/null || true
377                 need_restart=1
378         fi
379
380         if [ ! -e "$A2MODEDIR/rewrite.load" ]; then
381                 cp_echo "CN: Enabling rewrite module for Apache2 web server."
382                 a2enmod rewrite >/dev/null || true
383                 need_restart=1
384         fi
385
386         if [ ! -e "$A2MODEDIR/userdir.load" ] || [ ! -e "$A2MODEDIR/userdir.conf" ]; then
387                 cp_echo "CN: Enabling userdir module for Apache2 web server."
388                 a2enmod userdir >/dev/null || true
389                 need_restart=1
390         fi
391
392         if [ ! -e "$A2MODEDIR/suexec.load" ]; then
393                 cp_echo "CN: Enabling SUEXEC module for Apache2 web server."
394                 a2enmod suexec >/dev/null || true
395                 need_restart=1
396         fi
397
398         if [ ! -e "$A2MODEDIR/php4.load" ] || [ ! -e "$A2MODEDIR/php4.conf" ]; then
399                 cp_echo "CN: Enabling PHP4 module for Apache2 web server."
400                 a2enmod php4 >/dev/null || true
401                 need_restart=1
402         fi
403
404         if [ ! -e "$A2MODEDIR/ssl.load" ] || [ ! -e "$A2MODEDIR/ssl.conf" ]; then
405                 cp_echo "CN: Enabling SSL module for Apache2 web server."
406                 a2enmod ssl >/dev/null || true
407                 need_restart=1
408         fi
409 fi
410
411
412 # Install CARNet specific configuration file.
413 #
414 install_conf carnet 000-carnet
415
416 # Enable SSL port (443).
417 #
418 listen_ssl
419
420 # Disable default site configuration.
421 #
422 if [ -e "$CONF" ]; then
423         if [ -e "$CONFDIR/sites-enabled/000-default" ]; then
424                 cp_echo "CN: Disabling 000-default site configuration."
425                 a2dissite 000-default >/dev/null || true
426
427                 need_restart=1
428         fi
429 fi
430
431
432 # Apache2 SSL certificate.
433 #
434 has_listen_ssl=0
435
436 if [ -d "$CONFDIR/conf.d" ] && [ -n "$(ls $CONFDIR/conf.d)" ]; then
437         listen_ssl_mask=$CONFDIR/conf.d/*
438 fi
439 if [ -d "$CONFDIR/sites-enabled" ] && [ -n "$(ls $CONFDIR/sites-enabled)" ]; then
440         listen_ssl_mask=$listen_ssl_mask" "$CONFDIR/sites-enabled/*
441 fi
442
443 for file in $CONF $listen_ssl_mask; do
444         if [ -f "$file" ]; then
445                 if egrep -iq '^[[:space:]]*<VirtualHost .*443[[:space:]]*>' $file; then
446                         has_listen_ssl=1
447                         apache2_sslcert=1
448                         break
449                 fi
450         fi
451 done
452
453 if [ $apache2_sslcert -eq 0 ]; then
454
455         db_get apache2-cn/sslcf || true
456         apache2_sslcf="$RET"
457
458         if [ -n "$apache2_sslcf" ]; then
459
460                 db_get apache2-cn/sslckf || true
461                 apache2_sslckf="$RET"
462
463                 db_get apache2-cn/sslccf || true
464                 apache2_sslccf="$RET"
465         
466                 need_restart=1
467         else
468
469                 # Generate new SSL certificate files.
470                 generate_ssl
471         
472                 apache2_sslcf=
473                 apache2_sslckf=
474                 apache2_sslccf=
475         fi
476 fi
477
478
479 # Add VirtualHosts.
480 #
481 db_get apache2-cn/wwwhost || true
482 if [ "$RET" = "true" ]; then
483
484         # Add WWW VirtualHost.
485         if [ -f "$CONFDIR/sites-available/$FQDN" ]; then
486                 cp_backup_conffile -d $BACKUPDIR -p $CONFDIR/sites-available/$FQDN
487         fi
488         if [ -f "$CONFDIR/sites-available/www.$DOMAIN" ]; then
489                 cp_backup_conffile -d $BACKUPDIR -p $CONFDIR/sites-available/www.$DOMAIN
490         fi
491
492         chk_conf_tag "$CONFDIR/sites-available/$FQDN"
493         if [ ! -f "$CONFDIR/sites-available/$FQDN" ] || [ $RET -eq 0 -a -f "$CONFOLD" ]; then
494                 install_vhost -nvh -d -r www.$DOMAIN default $FQDN 000-$FQDN
495                 need_restart=1
496         fi
497
498         chk_conf_tag "$CONFDIR/sites-available/www.$DOMAIN"
499         if [ ! -f "$CONFDIR/sites-available/www.$DOMAIN" ] || [ $RET -eq 0 -a -f "$CONFOLD" ]; then
500                 install_vhost default www.$DOMAIN www.$DOMAIN
501                 need_restart=1
502         fi
503 else
504
505         # No WWW VirtualHost.
506         if [ -f "$CONFDIR/sites-available/$FQDN" ]; then
507                 cp_backup_conffile -d $BACKUPDIR -p $CONFDIR/sites-available/$FQDN
508         fi
509
510         chk_conf_tag "$CONFDIR/sites-available/$FQDN"
511         if [ ! -f "$CONFDIR/sites-available/$FQDN" ] || [ $RET -eq 0 -a -f "$CONFOLD" ]; then
512                 install_vhost -nvh -d -r $FQDN default $FQDN 000-$FQDN
513                 need_restart=1
514         fi
515 fi
516
517
518 # Add VirtualHost for SSL?
519 #
520 if [ $apache2_sslcert -eq 0 ]; then
521
522         if [ -f "$CONFDIR/sites-available/ssl" ]; then
523                 cp_backup_conffile -d $BACKUPDIR -p $CONFDIR/sites-available/ssl
524         fi
525
526         # No active SSL VirtualHosts found - add new one.
527         chk_conf_tag "$CONFDIR/sites-available/ssl"
528         if [ ! -f "$CONFDIR/sites-available/ssl" ] || [ $RET -eq 0 -a -f "$CONFOLD" ]; then
529                 install_vhost -r $FQDN -n $HOST ssl ssl 001-ssl
530                 need_restart=1
531         fi
532 fi
533
534
535 # Check SSL certificates location for VirtualHosts.
536 #
537 if [ $apache2_sslcert -eq 0 ]; then
538
539         chk_conf_tag "${CONFDIR}/sites-available/ssl"
540         if [ $RET -eq 0 ] && [ -n "$apache2_sslcf" ]; then
541
542                 SSLTMP=$(mktemp ${CONFDIR}/ssltmp.XXXXXX)
543                 temp_files="${temp_files} ${SSLTMP}"
544                 cp ${CONFDIR}/sites-available/ssl $SSLTMP
545
546                 # SSLCertificateFile
547                 cp_check_and_sed "^[[:space:]]*SSLCertificateFile \/etc\/ssl\/certs\/apache2\.pem" \
548                     "s#SSLCertificateFile /etc/ssl/certs/apache2.pem#SSLCertificateFile $apache2_sslcf #g" \
549                     $SSLTMP || true
550
551                 # SSLCertificateKeyFile
552                 cp_check_and_sed "^[[:space:]]*SSLCertificateKeyFile \/etc\/ssl\/private\/apache2\.key" \
553                     "s#SSLCertificateKeyFile /etc/ssl/private/apache2.key#SSLCertificateKeyFile $apache2_sslckf #g" \
554                     $SSLTMP || true
555
556                 # SSLCertificateChainFile
557                 if [ -n "$apache2_sslccf" ]; then
558                 cp_check_and_sed "^# SSLCertificateChainFile \/etc\/ssl\/certs/sureserverEDU\.pem" \
559                     "s#\# SSLCertificateChainFile /etc/ssl/certs/sureserverEDU.pem#SSLCertificateChainFile $apache2_sslccf #g" \
560                     $SSLTMP || true
561                 fi
562
563                 cp_mv $SSLTMP ${CONFDIR}/sites-available/ssl
564
565                 need_restart=1
566
567                 # Just to be sure.
568                 if [ -e "$SSLTMP" ]; then
569                         rm -f $SSLTMP
570                 fi
571         fi
572 fi
573
574
575 # Check for CustomLog, ErrorLog and TransferLog in Apache2 configuration.
576 #
577 cp_echo "CN: Checking Apache2 CustomLog, ErrorLog and TransferLog directives."
578 if [ -d "$CONFDIR/conf.d" ] && [ -n "$(ls $CONFDIR/conf.d)" ]; then
579         log_mask=$CONFDIR/conf.d/*
580 fi
581 if [ -d "$CONFDIR/sites-available" ] && [ -n "$(ls $CONFDIR/sites-available)" ]; then
582         log_mask=$log_mask" "$CONFDIR/sites-available/*
583 fi
584 for file in $CONF $log_mask; do
585         chk_conf_tag "$file"
586         if [ $RET -eq 0 ]; then
587                 conf_log_fix "$file"
588         fi
589 done
590
591
592 # Start Apache2 web server on boot?
593 # This will enable Apache2 in /etc/default/apache2 file.
594 #
595 if egrep -q "^[[:space:]]*NO_START=1" /etc/default/apache2; then
596         cp_check_and_sed NO_START=1 s/NO_START=1/NO_START=0/ /etc/default/apache2 || true
597         need_restart=1
598 fi
599
600
601 db_stop || true
602
603
604 # Remove old AOSI configuration for Apache: aosi-www.conf, aosi.conf.
605 #
606 if [ -e "$CONFDIR/conf.d/aosi-www.conf" ] || [ -e "$CONFDIR/conf.d/aosi.conf" ]; then
607         cp_echo "CN: Removing old AOSI configuration files for Apache2."
608         need_restart=1
609 fi
610 [ -e "$CONFDIR/conf.d/aosi-www.conf" ] && rm -f $CONFDIR/conf.d/aosi-www.conf
611 [ -e "$CONFDIR/conf.d/aosi.conf" ] && rm -f $CONFDIR/conf.d/aosi.conf
612
613
614 # Stop Apache web server and disable Apache automatic start on boot.
615 #
616 if [ -x "/etc/init.d/apache" ]; then
617
618         # Stop Apache.
619         if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
620                 invoke-rc.d apache stop || true
621         else
622                 /etc/init.d/apache stop || true
623         fi
624
625         # Disable automatic start on boot.
626         if [ -x "`which update-rc.d 2>/dev/null`" ]; then
627                 update-rc.d -f apache remove > /dev/null 2>&1 || true
628                 update-rc.d apache stop 90 6 . > /dev/null 2>&1 || true
629         fi
630 fi
631
632 # Also check for Apache-SSL web server.
633 #
634 if [ -x "/etc/init.d/apache-ssl" ]; then
635
636         # Stop Apache-SSL.
637         if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
638                 invoke-rc.d apache-ssl stop || true
639         else
640                 /etc/init.d/apache-ssl stop || true
641         fi
642
643         # Disable automatic start on boot.
644         if [ -x "`which update-rc.d 2>/dev/null`" ]; then
645                 update-rc.d -f apache-ssl remove > /dev/null 2>&1 || true
646                 update-rc.d apache-ssl stop 90 6 . > /dev/null 2>&1 || true
647         fi
648 fi
649
650
651 # Restart Apache2 web server if needed.
652 #
653 if [ $need_restart -eq 1 ]; then
654
655         # Check Apache2 web server configuration.
656         if apache2ctl configtest 2>/dev/null; then
657
658                 # Restart Apache2 web server.
659                 if [ -x "/etc/init.d/apache2" ]; then
660                     if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
661                         invoke-rc.d apache2 force-reload || true
662                     else
663                         /etc/init.d/apache2 force-reload || true
664                     fi
665                 fi
666         else
667
668                 # Something is broken.
669                 cp_echo "CN: Your Apache2 configuration seem to be broken."
670                 cp_echo "CN: Please, check the service after the installation finishes!"
671         fi
672 fi
673
674
675 # Mail root
676 #
677 cp_mail "$PKG"
678
679
680 # (re)generate monit.d files if monit-cn is installed.
681 #
682 if [ -x "/usr/sbin/update-monit.d" ]; then
683         update-monit.d || true
684 fi
685
686
687 exit 0