/bin/live-uptime is in live-tools 3.0.20-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | #!/bin/sh
## live-tools(7) - System Support Scripts
## Copyright (C) 2006-2013 Daniel Baumann <daniel@debian.org>
##
## This program comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
## This is free software, and you are welcome to redistribute it
## under certain conditions; see COPYING for details.
set -e
if [ ! -e /usr/bin/uptime.orig.procps ]
then
echo "E: /usr/bin/uptime.orig.procps - command not found"
echo "E: On Debian based systems, uptime from procps"
echo "E: can be installed with:"
echo "E: apt-get install procps"
exit 1
fi
_UPTIME="$(/usr/bin/uptime.orig.procps)"
_DATE_HOST="$(date +%s)"
_DATE_LXC="$(stat -c %z /dev/pts)"
_DATE_LXC="$(date +%s -d"${_DATE_LXC}")"
_UPTIME_LXC="$((${_DATE_HOST} - ${_DATE_LXC}))"
if [ "${_UPTIME_LXC}" -gt 172800 ]
then
# LXC uptime >= 2 days
_DAYS="$((${_UPTIME_LXC} / 86400))"
_UPTIME="$(echo ${_UPTIME} | sed -e "s|up .* days,|up ${_DAYS} days,|")"
else
# LXC uptime < 2 days
_HOURS="$((${_UPTIME_LXC} / 3600))"
_MINUTES="$((${_UPTIME_LXC} - ${_HOURS}))"
_MINUTES="$((${_MINUTES} / 60))"
_UPTIME="$(echo ${_UPTIME} | sed -e "s|up .*, |up ${_HOURS}:${_MINUTES}, |")"
fi
echo " ${_UPTIME}"
|