| OLD | NEW |
| 1 #!/bin/sh | 1 #!/bin/sh |
| 2 | 2 |
| 3 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved. | 3 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 # Shutdown is best-effort. We don't want to die on errors. | 7 # Shutdown is best-effort. We don't want to die on errors. |
| 8 set +e | 8 set +e |
| 9 | 9 |
| 10 # Measure shutdown time. /var/log/metrics is created by chromeos_startup. | 10 # Measure shutdown time. /var/log/metrics is created by chromeos_startup. |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 | 36 |
| 37 # join hwclock setting, already in progress. If the job has already been | 37 # join hwclock setting, already in progress. If the job has already been |
| 38 # finished and reaped, we need to suppress error output. It seems that anything | 38 # finished and reaped, we need to suppress error output. It seems that anything |
| 39 # on stderr will make the shutdown appear "unclean" from the POV of upstart. | 39 # on stderr will make the shutdown appear "unclean" from the POV of upstart. |
| 40 (fg ${HWCLOCK} || /bin/true) 2> /dev/null | 40 (fg ${HWCLOCK} || /bin/true) 2> /dev/null |
| 41 | 41 |
| 42 # Measure shutdown time | 42 # Measure shutdown time |
| 43 cut -f 1 -d ' ' /proc/uptime > /var/log/metrics/uptime_shutdown_stop | 43 cut -f 1 -d ' ' /proc/uptime > /var/log/metrics/uptime_shutdown_stop |
| 44 cat /sys/block/sda/stat > /var/log/metrics/disk_shutdown_stop | 44 cat /sys/block/sda/stat > /var/log/metrics/disk_shutdown_stop |
| 45 | 45 |
| 46 # Signal that the clean shutdown point was reached (or at least as |
| 47 # close to that point as we can be before stateful is unmounted). |
| 48 /sbin/crash_reporter --clean_shutdown |
| 49 |
| 46 # Lazy umount the tmpfs dirs under /var so we can immediately umount it. | 50 # Lazy umount the tmpfs dirs under /var so we can immediately umount it. |
| 47 umount -n -l /var/tmp /var/run /var/lock | 51 umount -n -l /var/tmp /var/run /var/lock |
| 48 umount -n /var /usr/local /home /mnt/stateful_partition | 52 umount -n /var /usr/local /home /mnt/stateful_partition |
| 49 if [ $? -ne 0 ] ; then | 53 if [ $? -ne 0 ] ; then |
| 50 mount > /mnt/stateful_partition/var/log/shutdown_stateful_umount_failure | 54 mount > /mnt/stateful_partition/var/log/shutdown_stateful_umount_failure |
| 51 mount > /var/log/shutdown_stateful_umount_failure | 55 mount > /var/log/shutdown_stateful_umount_failure |
| 52 fi | 56 fi |
| 53 | 57 |
| 54 # Just in case something didn't unmount properly above. | 58 # Just in case something didn't unmount properly above. |
| 55 sync | 59 sync |
| 56 | 60 |
| 57 # Ensure that we always claim success. | 61 # Ensure that we always claim success. |
| 58 exit 0 | 62 exit 0 |
| OLD | NEW |