Browse Source

Force $lastbackup to use latest date.

Use ls -1tr in place of find
      * produce a simple list,
      * one item per line,
      * sorted by date reverse.
pull/3328/head
Bryan Jeter 4 years ago
parent
commit
389964f739
  1. 24
      lgsm/functions/info_distro.sh

24
lgsm/functions/info_distro.sh

@ -8,6 +8,10 @@
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
### Game Server pid
if [ "${status}" == "1" ]; then
gameserverpid=$(tmux list-sessions -F "#{session_name} #{pane_pid}" | grep "^${sessionname} " | awk '{print $NF}')
fi
### Distro information
## Distro
@ -66,17 +70,17 @@ done
glibcversion=$(ldd --version | sed -n '1s/.* //p')
## tmux version
tmuxv=$(tmux -V | sed "s/tmux //")
tmuxvdigit=$(echo "${tmuxv}" | tr -cd '[:digit:]')
## Game Server pid
if [ "${status}" == "1" ]&&[ "${tmuxv}" != "1.8" ]; then
gameserverpid=$(tmux list-sessions -F "#{session_name} #{pane_pid}" | grep "^${sessionname} " | awk '{print $NF}')
# e.g: tmux 1.6
if [ ! "$(command -V tmux 2>/dev/null)" ]; then
tmuxv="${red}NOT INSTALLED!${default}"
else
if [ "$(tmux -V | sed "s/tmux //" | sed -n '1 p' | tr -cd '[:digit:]')" -lt "16" ]; then
tmuxv="$(tmux -V) (>= 1.6 required for console log)"
else
tmuxv=$(tmux -V)
fi
fi
## Date
date="$(date)"
## Uptime
uptime=$(</proc/uptime)
uptime=${uptime/[. ]*/}
@ -208,7 +212,7 @@ if [ -d "${backupdir}" ]; then
# number of backups.
backupcount=$(find "${backupdir}"/*.tar.gz | wc -l)
# most recent backup.
lastbackup=$(find "${backupdir}"/*.tar.gz | tail -1)
lastbackup=$(ls -1tr "${backupdir}"/*.tar.gz | head -1)
# date of most recent backup.
lastbackupdate=$(date -r "${lastbackup}")
# no of days since last backup.

Loading…
Cancel
Save