Compare commits
27 Commits
prog_shell
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 2b72129621 | |||
| 971a2c64f3 | |||
| 029715a811 | |||
| b3ec608966 | |||
| 670e749451 | |||
| d4c6cd5eb8 | |||
| 0993562ca0 | |||
| d4d5885daa | |||
| 62b5f7f6e4 | |||
| 1ac9cb9e50 | |||
| e512af4a41 | |||
| e74ada7369 | |||
| e8f10d4e42 | |||
| 83aa4dc018 | |||
| d70db48add | |||
| 203d20bb11 | |||
| 4f2d8f9bac | |||
| 451752901c | |||
| 347a9362ad | |||
| 1a311bc1cf | |||
| 9538b1f0d6 | |||
| 60f8fb1782 | |||
| fb03f6318c | |||
| 3bc7f94ac2 | |||
| 5b642806b1 | |||
| 9921222131 | |||
| bb26868607 |
282
functions.sh
Normal file → Executable file
282
functions.sh
Normal file → Executable file
@@ -4,6 +4,35 @@ function e {
|
|||||||
echo -ne "${1};"
|
echo -ne "${1};"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# get machine number from name
|
||||||
|
# arg1: name of machine
|
||||||
|
|
||||||
|
function getMachineNumber {
|
||||||
|
latest=${1: -2}
|
||||||
|
left=${latest:0:1}
|
||||||
|
match='[0-9]'
|
||||||
|
if [[ "$left" =~ $match ]] ; then
|
||||||
|
echo $latest
|
||||||
|
else
|
||||||
|
echo ${1: -1}
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# get first line of file
|
||||||
|
function fisrstLine {
|
||||||
|
if [ ! -f $1 ] ; then echo -ne "0;" ; return 0 ; fi
|
||||||
|
head -n 1 $1
|
||||||
|
}
|
||||||
|
# file age
|
||||||
|
# return 0 if given file mtime is older than given age (in day)
|
||||||
|
# arg1: file
|
||||||
|
# arg2: age to compare
|
||||||
|
function _fileOlderThan {
|
||||||
|
if [ ! -f $1 ] ; then echo -ne "0;" ; return 0 ; fi
|
||||||
|
test $(find test -mtime +$2)
|
||||||
|
return $?
|
||||||
|
}
|
||||||
|
|
||||||
# file mtime
|
# file mtime
|
||||||
# arg1: file
|
# arg1: file
|
||||||
function fileMTime {
|
function fileMTime {
|
||||||
@@ -11,14 +40,24 @@ function fileMTime {
|
|||||||
stat --printf "%y;" $1
|
stat --printf "%y;" $1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# file numline
|
||||||
|
# arg1: file
|
||||||
|
function fileNumLines {
|
||||||
|
if [ ! -f $1 ] ; then echo -ne "0;" ; return 0 ; fi
|
||||||
|
n=$(wc -l $1 | awk '{print $1}')
|
||||||
|
echo -ne "$n;"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#ok if given program returns given code
|
#ok if given program returns given code
|
||||||
# arg1: program to run
|
# arg1: chroot
|
||||||
# arg2: expected return code (default 0)
|
# arg2: program to run
|
||||||
|
# arg2: expected return code
|
||||||
function exitCodeOk {
|
function exitCodeOk {
|
||||||
program=$1
|
chroot=$1
|
||||||
code=${2:=0}
|
program=$2
|
||||||
$program &> /dev/null
|
code=${3}
|
||||||
|
chroot ${chroot} bash -c "$program" &> /dev/null
|
||||||
if [ $? -eq $code ] ; then echo -ne "1;" ; else echo -ne "0;" ; fi
|
if [ $? -eq $code ] ; then echo -ne "1;" ; else echo -ne "0;" ; fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -31,17 +70,18 @@ function fileBiggerThan {
|
|||||||
if [ $filesize -lt $2 ] ; then echo -ne "0;" ; else echo -ne "1;" ; fi
|
if [ $filesize -lt $2 ] ; then echo -ne "0;" ; else echo -ne "1;" ; fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#Ok if file exists
|
#Ok if file exists
|
||||||
# arg1: file to check
|
# arg1: file to check
|
||||||
function fileMustExist {
|
function fileMustExists {
|
||||||
if [ -f ${1} ] ; then echo -ne "1;"
|
if [ -f "${1}" ] ; then echo -ne "1;"
|
||||||
else echo -ne "0;"
|
else echo -ne "0;"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
#Ok if file DOESNOT exists
|
#Ok if file DOESNOT exists
|
||||||
# arg1: file to check
|
# arg1: file to check
|
||||||
function fileMustNOTExist {
|
function fileMustNOTExists {
|
||||||
if [ -f ${1} ] ; then echo -ne "0;"
|
if [ -f ${1} ] ; then echo -ne "0;"
|
||||||
else echo -ne "1;"
|
else echo -ne "1;"
|
||||||
fi
|
fi
|
||||||
@@ -49,28 +89,43 @@ fi
|
|||||||
|
|
||||||
#Ok if dir exists
|
#Ok if dir exists
|
||||||
# arg1: dir to check
|
# arg1: dir to check
|
||||||
function dirMustExist {
|
function dirMustExists {
|
||||||
if [ -d ${1} ] ; then echo -ne "1;"
|
if [ -d ${1} ] ; then e 1
|
||||||
else echo -ne "0;"
|
else e 0
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
# Ok if given dir DOESNOT exists
|
# Ok if given dir DOESNOT exists
|
||||||
# arg1: dir
|
# arg1: dir
|
||||||
function dirMustNOTExist {
|
function dirMustNOTExists {
|
||||||
if [ -d ${1} ] ; then echo -ne "0;"
|
if [ -d ${1} ] ; then echo -ne "0;"
|
||||||
else echo -ne "1;"
|
else echo -ne "1;"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Ok if some files of given dir contains at least one occurence of pattern
|
||||||
|
# arg1: dir
|
||||||
|
# arg2: pattern
|
||||||
|
function dirMustContains {
|
||||||
|
dir=$1
|
||||||
|
shift
|
||||||
|
string=$@
|
||||||
|
if [ ! -d $dir ] ; then echo -ne "0;" ; return 0 ;fi
|
||||||
|
if ( grep -ri -qE "${string}" $dir ) ;
|
||||||
|
then echo -ne "1;"
|
||||||
|
else
|
||||||
|
echo -ne "0;"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# Ok if file contains at least one occurence of pattern
|
# Ok if file contains at least one occurence of pattern
|
||||||
# arg1: file
|
# arg1: file
|
||||||
# arg2: pattern
|
# arg2: pattern
|
||||||
function fileMustContain {
|
function fileMustContains {
|
||||||
file=$1
|
file=$1
|
||||||
shift
|
shift
|
||||||
string=$@
|
string=$@
|
||||||
if [ ! -f $file ] ; then echo -ne "0;" ; return 0 ;fi
|
if [ ! -f $file ] ; then echo -ne "0;" ; return 0 ;fi
|
||||||
if ( grep -i -qE "${string}" $file ) ;
|
if ( grep -i -qE -- "${string}" $file ) ;
|
||||||
then echo -ne "1;"
|
then echo -ne "1;"
|
||||||
else
|
else
|
||||||
echo -ne "0;"
|
echo -ne "0;"
|
||||||
@@ -84,16 +139,37 @@ function fileCountPattern {
|
|||||||
file=$1
|
file=$1
|
||||||
shift
|
shift
|
||||||
string=$@
|
string=$@
|
||||||
|
if [ ! -f $file ] ; then e 0 ; return 0 ;fi
|
||||||
|
local size=$(stat --printf '%s' $file)
|
||||||
|
if [ $size -eq 0 ] ; then e 0 ; return 0 ; fi
|
||||||
|
num=$(grep -ciE "${string}" $file )
|
||||||
|
e "$num"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Ok if file contains at least N pattern
|
||||||
|
# arg1: file
|
||||||
|
# arg2: num of expected item
|
||||||
|
# arg3: pattern
|
||||||
|
function fileMustContainsMoreNItem {
|
||||||
|
file=$1
|
||||||
|
n=$2
|
||||||
|
shift
|
||||||
|
shift
|
||||||
|
string=$@
|
||||||
if [ ! -f $file ] ; then echo -ne "0;" ; return 0 ;fi
|
if [ ! -f $file ] ; then echo -ne "0;" ; return 0 ;fi
|
||||||
num=$(grep -ciE "${string}" $file )
|
num=$(grep -ciE "${string}" $file )
|
||||||
echo -ne "$num;"
|
if [ $num -ge $n ] ;
|
||||||
|
then echo -ne "1;"
|
||||||
|
else
|
||||||
|
echo -ne "0;"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Ok if file contains N pattern
|
# Ok if file contains N pattern
|
||||||
# arg1: file
|
# arg1: file
|
||||||
# arg2: num of expected item
|
# arg2: num of expected item
|
||||||
# arg3: pattern
|
# arg3: pattern
|
||||||
function fileMustContainNItem {
|
function fileMustContainsNItem {
|
||||||
file=$1
|
file=$1
|
||||||
n=$2
|
n=$2
|
||||||
shift
|
shift
|
||||||
@@ -110,7 +186,7 @@ function fileMustContainNItem {
|
|||||||
# Ok if file DOESNOT contain pattern
|
# Ok if file DOESNOT contain pattern
|
||||||
# Arg1: file
|
# Arg1: file
|
||||||
# ArgN: pattern
|
# ArgN: pattern
|
||||||
function fileMustNOTContain {
|
function fileMustNOTContains {
|
||||||
file=$1
|
file=$1
|
||||||
shift
|
shift
|
||||||
string=$@
|
string=$@
|
||||||
@@ -123,15 +199,17 @@ function fileMustNOTContain {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Ok if given user exists
|
# Ok if given user exists
|
||||||
# Arg1: user
|
# Arg1: chroot dir
|
||||||
|
# Arg2: user
|
||||||
function userExists {
|
function userExists {
|
||||||
if ( grep -iq $1 /etc/passwd ) ; then e 1 ; else e 0 ; fi
|
if ( grep -iq $2 ${1}/etc/passwd ) ; then e 1 ; else e 0 ; fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Ok if given group exists
|
# Ok if given group exists
|
||||||
# Arg1: group
|
# Arg1: chroot
|
||||||
|
# Arg2: group
|
||||||
function groupExists {
|
function groupExists {
|
||||||
if ( grep -iq $1 /etc/group ) ; then e 1 ; else e 0 ; fi
|
if ( grep -iq $2 ${root}/etc/group ) ; then e 1 ; else e 0 ; fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# insert hostname at beginning of result line
|
# insert hostname at beginning of result line
|
||||||
@@ -140,57 +218,163 @@ function addHeader {
|
|||||||
echo -ne "${user}$(hostname -s);"
|
echo -ne "${user}$(hostname -s);"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# get file content
|
||||||
|
# arg1: file to read
|
||||||
|
function getFileContent {
|
||||||
|
test -f $1 && content="$(cat $1 | sed 's/\n//');" || content="NULL;"
|
||||||
|
echo -ne "${content}"
|
||||||
|
}
|
||||||
|
|
||||||
|
# get file md5
|
||||||
|
# arg1: file to checksum
|
||||||
|
function md5 {
|
||||||
|
test -f "$2" && local am=$(md5sum "$1" | awk '{print $1}')
|
||||||
|
echo -ne "${am};"
|
||||||
|
}
|
||||||
|
|
||||||
|
# cleanUppkgList
|
||||||
|
# arg1: rootfs
|
||||||
|
function cleanUppkgList {
|
||||||
|
test -d ${1} || return 0
|
||||||
|
test -f ${1}/tmp/pkg.list && rm -f ${1}/tmp/pkg.list
|
||||||
|
}
|
||||||
|
|
||||||
|
# init pkg list
|
||||||
|
# arg1: rootfs
|
||||||
|
function initPkgList {
|
||||||
|
root="$1"
|
||||||
|
test -f "${1}/tmp/pkg.list" || chroot "$1" sh -c "rpm -qa > /tmp/pkg.list"
|
||||||
|
}
|
||||||
|
|
||||||
# Ok if given package is installed
|
# Ok if given package is installed
|
||||||
# arg1: pkg to check
|
# arg1: rootfs
|
||||||
|
# arg2: pkg to check
|
||||||
|
# WARNING: package list might not be up to date
|
||||||
function pkgInstalled {
|
function pkgInstalled {
|
||||||
pkglist=/tmp/pkg.list
|
if (grep -qi "$2" "${1}/tmp/pkg.list" ) ; then e 1 ; else e 0 ; fi
|
||||||
test -f $pkglist || rpm -qa > $pkglist
|
|
||||||
if ( grep -qi $1 $pkglist ) ; then echo -ne "1;" ; else echo -ne "0;" ; fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Ok if given package is NOT installed
|
# Ok if given package is NOT installed
|
||||||
# arg1: pkg to check
|
# arg1: pkg to check
|
||||||
|
# WARNING: package list might not be up to date
|
||||||
function pkgNotInstalled {
|
function pkgNotInstalled {
|
||||||
pkglist=/tmp/pkg.list
|
if (grep -qi "$2" "${1}/tmp/pkg.list" ) ; then e 0 ; else e 1 ; fi
|
||||||
test -f $pkglist || rpm -qa > $pkglist
|
echo -ne "${?};"
|
||||||
if ( grep -qiE $1 $pkglist ) ; then echo -ne "0;" ; else echo -ne "1;" ; fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# WIP: dont work
|
||||||
|
|
||||||
|
# ok if given process is listening on given port
|
||||||
|
# arg1: chroot
|
||||||
|
# arg2: process to check
|
||||||
|
# arg3: port
|
||||||
|
function processIsListening {
|
||||||
|
chroot=$1
|
||||||
|
process=$2
|
||||||
|
port=$3
|
||||||
|
chroot $chroot bash -c "ss -taupen|grep -q \"LISTEN.*:${port}.*${process}\""
|
||||||
|
test $? -eq 0 && e 1 || e 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# WIP: dont work
|
||||||
|
|
||||||
# ok if given process is running
|
# ok if given process is running
|
||||||
# arg1: process to check
|
# arg1: chroot
|
||||||
|
# arg2: process to check
|
||||||
function processIsRunning {
|
function processIsRunning {
|
||||||
if ( pgrep -f $1 &> /dev/null ) ; then echo -ne "1;" ; else echo -ne "0;" ; fi
|
chroot=$1
|
||||||
|
process=$2
|
||||||
|
chroot $chroot bash -c "ps -ef | grep -q $process"
|
||||||
|
test $? -ne 0 && e 1 || e 0
|
||||||
}
|
}
|
||||||
|
|
||||||
#Ok if given command returns 0
|
#Ok if given command returns 0
|
||||||
# arg1: command to be run
|
# arg1: chroot dir
|
||||||
|
# arg2: command to be run
|
||||||
function commandIsWorking {
|
function commandIsWorking {
|
||||||
command=$1
|
chroot=$1
|
||||||
if ( $command &> /dev/null ) ; then echo -ne "1;" ; else echo -ne "0;" ; fi
|
shift
|
||||||
|
command="$@"
|
||||||
|
chroot ${chroot} bash -c "$command" &> /dev/null
|
||||||
|
ret=$?
|
||||||
|
if [ $ret -eq 0 ] ; then e 1 ; else e 0 ; fi
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
# return latest line of commande output
|
||||||
|
# arg1: chroot dir
|
||||||
|
# arg2: command to be run
|
||||||
|
function commandOutput {
|
||||||
|
chroot=$1
|
||||||
|
shift
|
||||||
|
command="$@"
|
||||||
|
result=$(chroot ${chroot} bash -c "$command" 2>&1)
|
||||||
|
e "$result"
|
||||||
|
}
|
||||||
|
|
||||||
|
# get num of files in given dir
|
||||||
|
# arg1: dir
|
||||||
|
function numFilesInDir {
|
||||||
|
local dir=$1
|
||||||
|
test -d $dir || { e 0 ; return 0 ; }
|
||||||
|
local n=$(ls -l $dir | wc -l)
|
||||||
|
e $n
|
||||||
|
}
|
||||||
|
|
||||||
|
# check wether file mode is correct
|
||||||
|
# arg1: file
|
||||||
|
# arg2: mode
|
||||||
|
function modeIsCorrect {
|
||||||
|
file=$1
|
||||||
|
mode=$2
|
||||||
|
if [ ! -e $1 ] ; then e 0 ; return 0 ; fi
|
||||||
|
current_mode=$(stat --format "%a" $1)
|
||||||
|
if [ "$mode" = "$current_mode" ] ; then e 1 ; else e 0 ; fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# check wether file owner is correct
|
||||||
|
# arg1: file
|
||||||
|
# arg2: owner
|
||||||
|
function ownerIsCorrect {
|
||||||
|
file=$1
|
||||||
|
owner=$2
|
||||||
|
if [ ! -e $1 ] ; then e 0 ; return 0 ; fi
|
||||||
|
current_owner=$(stat --format "%u" $1)
|
||||||
|
if [ "$owner" = "$current_owner" ] ; then e 1 ; else e 0 ; fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# check wether file group is correct
|
||||||
|
# arg1: file
|
||||||
|
# arg2: group
|
||||||
|
function groupIsCorrect {
|
||||||
|
file=$1
|
||||||
|
group=$2
|
||||||
|
if [ ! -e $1 ] ; then e 0 ; return 0 ; fi
|
||||||
|
current_group=$(stat --format "%g" $1)
|
||||||
|
if [ "$group" = "$current_group" ] ; then e 1 ; else e 0 ; fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# ok if given pattern is detected on command's stdout or stderr
|
# ok if given pattern is detected on command's stdout or stderr
|
||||||
# arg1: command
|
# arg1: chroot
|
||||||
# arg2: pattern
|
# arg2: command
|
||||||
|
# arg3: pattern
|
||||||
function commandStdoutPattern {
|
function commandStdoutPattern {
|
||||||
command=$1
|
local chroot=$1
|
||||||
shift
|
local command=$2
|
||||||
pattern=$@
|
local pattern="$3"
|
||||||
if ( $command 2>&1 | grep -qiE "${pattern}" ) ; then echo -ne "1;" ; else echo -ne "0;" ; fi
|
|
||||||
|
result=$(chroot ${chroot} bash -c "$command" 2> /dev/null)
|
||||||
|
if ( echo -n "$result" | grep -qiE "${pattern}" ) ; then echo -ne "1;" ; else echo -ne "0;" ; fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# ok if given service is enabled
|
# ok if given service is enabled
|
||||||
# arg1: service
|
# arg1: service
|
||||||
function serviceIsEnabled {
|
function serviceIsEnabled {
|
||||||
service=$1
|
local root=$1
|
||||||
if ( systemctl is-enabled $1 &> /dev/null ) ; then echo -ne "1;" ; else echo -ne "0;" ; fi
|
local service=${2}.service
|
||||||
}
|
c=$(ls -l ${root}/etc/systemd/system/multi-user.target.wants/ | grep -i ${service} | wc -l)
|
||||||
|
if [ $c -gt 0 ] ; then e 1 ; else e 0 ; fi
|
||||||
# ok if given service is active
|
|
||||||
# arg1: service
|
|
||||||
function serviceIsActive {
|
|
||||||
service=$1
|
|
||||||
if ( systemctl is-active $1 &> /dev/null ) ; then echo -ne "1;" ; else echo -ne "0;" ; fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# ok if output of given url contains given stuff
|
# ok if output of given url contains given stuff
|
||||||
@@ -199,5 +383,5 @@ function serviceIsActive {
|
|||||||
function okIfCurl {
|
function okIfCurl {
|
||||||
url=$1
|
url=$1
|
||||||
shift
|
shift
|
||||||
if ( curl -q "${url}" | grep -q "$@" ) ; then echo -ne "1;" ; else echo -ne "0;" ; fi
|
if ( curl -q --silent "${url}" | grep -qE "$@" ) ; then echo -ne "1;" ; else echo -ne "0;" ; fi
|
||||||
}
|
}
|
||||||
|
|||||||
23
initPkg.sh
Normal file
23
initPkg.sh
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
#! /bin/bash
|
||||||
|
set -e
|
||||||
|
IFS=$'\n\t'
|
||||||
|
source functions.sh
|
||||||
|
echo -ne "host;name;root history;bash history;<+CHANGEME+>\n"
|
||||||
|
if [ $# -ge 1 ] ; then
|
||||||
|
hostlist=/srv/lxc/epsi/$1
|
||||||
|
else
|
||||||
|
hostlist=/srv/lxc/epsi/*
|
||||||
|
fi
|
||||||
|
for host in $hostlist ; do
|
||||||
|
root=${host}/rootfs
|
||||||
|
host=$(basename $host)
|
||||||
|
hostname=$(grep HOSTNAME ${root}/etc/sysconfig/network 2>/dev/null| cut -f2 -d=)
|
||||||
|
test -z "${hostname}" && hostname=$(cat ${root}/etc/hostname)
|
||||||
|
test -f ${root}/etc/motd && user="$(cat ${root}/etc/motd | xargs)"
|
||||||
|
echo -ne "${hostname};${user};"
|
||||||
|
unset user
|
||||||
|
initPkgList ${root}
|
||||||
|
|
||||||
|
echo
|
||||||
|
|
||||||
|
done
|
||||||
42
localeval.sh
42
localeval.sh
@@ -1,14 +1,32 @@
|
|||||||
#! /bin/bash
|
#! /bin/bash
|
||||||
|
#set -e
|
||||||
|
set -u
|
||||||
|
IFS=$'\n\t'
|
||||||
source functions.sh
|
source functions.sh
|
||||||
# check that alias has been tried
|
echo -ne "host;name;<+CHANGE+>\n"
|
||||||
echo -ne "host\tname\t<+CHANGEME+>\n"
|
function _process {
|
||||||
for host in /srv/lxc/epsi/b1/* ; do
|
fileMustExists ${root}/etc/postfix/main.cf
|
||||||
root=${host}/rootfs
|
<+ADD SOME FUNCTIONS+>
|
||||||
host=$(basename $host)
|
echo
|
||||||
hostname=$(grep HOSTNAME ${root}/etc/sysconfig/network | cut -f2 -d=)
|
}
|
||||||
test -f ${root}/etc/motd && user="$(cat ${root}/etc/motd | sed 's/\n//')\t"
|
|
||||||
echo -ne "${hostname}\t${user}"
|
if [ $# -gt 0 ] ; then
|
||||||
<+CHANGEME+>
|
root=/
|
||||||
echo
|
host=$(hostname)
|
||||||
done
|
test -f ${root}/etc/motd && user="$(cat ${root}/etc/motd | xargs -0)"
|
||||||
|
echo -ne "${host};${user};"
|
||||||
|
_process
|
||||||
|
else
|
||||||
|
hostlist=/srv/lxc/<+CHANGEME+>
|
||||||
|
for host in $hostlist ; do
|
||||||
|
root=${host}/rootfs
|
||||||
|
host=$(basename $host)
|
||||||
|
hostname=$(grep HOSTNAME ${root}/etc/sysconfig/network 2>/dev/null| cut -f2 -d=)
|
||||||
|
test -z "${hostname}" && hostname=$(cat ${root}/etc/hostname)
|
||||||
|
test -f ${root}/etc/motd && user="$(cat ${root}/etc/motd | xargs -0)"
|
||||||
|
test -z $user && continue
|
||||||
|
echo -ne "${hostname};${user};"
|
||||||
|
_process
|
||||||
|
unset user
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user