Server IP : 127.0.0.2 / Your IP : 18.188.252.203 Web Server : Apache/2.4.18 (Ubuntu) System : User : www-data ( ) PHP Version : 7.0.33-0ubuntu0.16.04.16 Disable Function : disk_free_space,disk_total_space,diskfreespace,dl,exec,fpaththru,getmyuid,getmypid,highlight_file,ignore_user_abord,leak,listen,link,opcache_get_configuration,opcache_get_status,passthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,php_uname,phpinfo,posix_ctermid,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix,_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_times,posix_ttyname,posix_uname,pclose,popen,proc_open,proc_close,proc_get_status,proc_nice,proc_terminate,shell_exec,source,show_source,system,virtual MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/lib/update-notifier/ |
Upload File : |
#!/bin/sh # Authors: # Mads Chr. Olesen <mads@mchro.dk> # Kees Cook <kees@ubuntu.com> set -e # poor mans force if [ "$1" = "--force" ]; then NEEDS_FSCK_CHECK=yes fi # check time when we did the last check stamp="/var/lib/update-notifier/fsck-at-reboot" if [ -e "$stamp" ]; then stampt=$(stat -c %Y $stamp) else stampt=0 fi # check time when we last booted last_boot=$(date -d "now - $(awk '{print $1}' /proc/uptime) seconds" +%s) now=$(date +%s) if [ $(($stampt + 3600)) -lt $now ] || [ $stampt -gt $now ] \ || [ $stampt -lt $last_boot ] then #echo $stampt $now need update NEEDS_FSCK_CHECK=yes fi # output something for update-motd if [ -n "$NEEDS_FSCK_CHECK" ]; then { check_occur_any= ext_partitions=$(mount | awk '$5 ~ /^ext(2|3|4)$/ { print $1 }') for part in $ext_partitions; do dumpe2fs_out=$(dumpe2fs -h $part 2>/dev/null) mount_count=$(echo "$dumpe2fs_out" | grep "^Mount count:"|cut -d':' -f 2-) if [ -z "$mount_count" ]; then mount_count=0; fi max_mount_count=$(echo "$dumpe2fs_out" | grep "^Maximum mount count:"|cut -d':' -f 2-) if [ -z "$max_mount_count" ]; then max_mount_count=0; fi check_interval=$(echo "$dumpe2fs_out" | grep "^Check interval:" | cut -d':' -f 2- | cut -d'(' -f 1) if [ -z "$check_interval" ]; then check_interval=0; fi next_check_date=$(echo "$dumpe2fs_out" | grep "^Next check after:" | cut -d':' -f 2-) if [ -z "$next_check_interval" ]; then next_check_interval=0; fi next_check_tstamp=$(date -d "$next_check_date" +%s) #echo "next_check_date=\"$next_check_date\" next_check_tstamp=\"$next_check_tstamp\"" #echo "part=\"$part\" mount_count=\"$mount_count\" / max=\"$max_mount_count\" " check_occur= # Check based on mount counts? if [ "$max_mount_count" -gt 0 -a \ "$mount_count" -ge "$max_mount_count" ]; then check_occur=yes fi # Check based on time passed? if [ "$check_interval" -gt 0 -a \ "$next_check_tstamp" -lt "$now" ]; then check_occur=yes fi if [ -n "$check_occur" ]; then check_occur_any=yes mountpoint=$(mount | grep "^$part" | cut -d ' ' -f 3) pass=$(grep -v '^#' /etc/fstab | tr -s ' ' '\t' | cut -s -f 2,6 | grep -w "$mountpoint" | cut -f 2) if [ "$pass" = "0" ]; then echo "*** $part should be checked for errors ***" else echo "*** $part will be checked for errors at next reboot ***" fi fi done if [ -n "$check_occur_any" ]; then echo "" fi } > $stamp fi # output what we have (either cached or newly generated) cat $stamp