summaryrefslogtreecommitdiffstats
path: root/abs/core
diff options
context:
space:
mode:
authorCecil <knoppmyth@gmail.com>2011-08-09 00:35:10 (GMT)
committerCecil <knoppmyth@gmail.com>2011-08-09 00:35:10 (GMT)
commitc7d475a307c528a21e994b30e36761ec84382e27 (patch)
tree4d58fc11d81f8322fb897f0e239dc3c8bb24f028 /abs/core
parent059553acb1fd81caac4cdf19ecbda399a0d83090 (diff)
parent8abd1b158d5998d04aeaba9a1c9554ce043d8aaa (diff)
downloadlinhes_pkgbuild-c7d475a307c528a21e994b30e36761ec84382e27.zip
linhes_pkgbuild-c7d475a307c528a21e994b30e36761ec84382e27.tar.gz
linhes_pkgbuild-c7d475a307c528a21e994b30e36761ec84382e27.tar.bz2
Merge branch 'testing' of ssh://cesman@linhes.org/mount/repository/linhes_pkgbuild into testing
Diffstat (limited to 'abs/core')
-rw-r--r--abs/core/linhes-scripts/PKGBUILD4
-rwxr-xr-xabs/core/linhes-scripts/idle.sh21
2 files changed, 20 insertions, 5 deletions
diff --git a/abs/core/linhes-scripts/PKGBUILD b/abs/core/linhes-scripts/PKGBUILD
index 076bac7..0b5c2a9 100644
--- a/abs/core/linhes-scripts/PKGBUILD
+++ b/abs/core/linhes-scripts/PKGBUILD
@@ -3,7 +3,7 @@
pkgname=linhes-scripts
pkgver=7
-pkgrel=4
+pkgrel=6
pkgdesc="Various scripts that help to make LinHES, LinHES."
arch=('i686' 'x86_64')
license=('GPL2')
@@ -74,7 +74,7 @@ md5sums=('f56985b2d602e11dc1e10d3e7848b2a5'
'3b776bbff68906ddc2f62b7e0dde3fe4'
'15f3143d2b1369da431e4268029aba40'
'3d0adf26280cde55a0c47188fff34826'
- '93aaa2940e33ec9ebb305b839ac46a3e'
+ '7ffe9cea9c5604b696a2a1d274c21ac3'
'b2c3dd48a4abb976eda2d5fbf22a173a'
'b527b01d119d3bc33b8fa69bdf1082bb'
'c537c44156d8404016cc4b405b092d45'
diff --git a/abs/core/linhes-scripts/idle.sh b/abs/core/linhes-scripts/idle.sh
index f95b9fa..13fdb89 100755
--- a/abs/core/linhes-scripts/idle.sh
+++ b/abs/core/linhes-scripts/idle.sh
@@ -1,11 +1,12 @@
#!/bin/bash
usage () {
- echo "Usage: $0 [-h] [-s] [-t <minutes_needed>]"
+ echo "Usage: $0 [-h] [-s] [-t <minutes_needed>] [-l] [-v]"
echo
echo "-h - Print this help/usage message and quit"
echo "-s - Run silently (default is verbose)"
echo "-t - Minutes of idle time needed (default is 20)"
+ echo "-l - Check for user logins (default: false - do not check)"
echo "-v - Be more verbose for debugging"
echo
echo "Silent mode is recommended for use in cron jobs or scripts."
@@ -22,14 +23,16 @@ mysql_cmd () {
# Command line argument handling
VERBOSE=1
+LOGINS=0
TIME_BEFORE=20
TIME_AFTER=5 # Only adjustable by editing here
-while getopts "hst:v" OPT ; do
+while getopts "hslt:v" OPT ; do
case $OPT in
h) usage 0 ;;
s) VERBOSE=0 ;;
t) TIME_BEFORE=$OPTARG ;;
+ l) LOGINS=1 ;;
v) VERBOSE=2 ;;
*) usage 1 ;;
esac
@@ -91,7 +94,19 @@ if [ "$VERBOSE" -ge 2 ] ; then
item += 1;
}'
fi
-activities=$(($BUSY + $SCHEMALOCK + $JOBS + $INUSE + $UPCOMING))
+
+if [ "$LOGINS" -ge 1 ] ; then
+ USERS=`/usr/bin/last | /bin/grep "still logged in" | awk '{ print $1 }'`
+ if [ -n "$USERS" ] ; then
+ LOGINS=1
+ msg "The following user(s) are still logged in: ${USERS}"
+ else
+ LOGINS=0
+ msg "No user(s) are logged in..."
+ fi
+fi
+
+activities=$(($BUSY + $SCHEMALOCK + $JOBS + $INUSE + $UPCOMING + $LOGINS))
msg
if [ "$activities" -eq 0 ] ; then
msg "System is idle"