Either it is or is not there so if you can get a listing from
Code: Select all
ls -al /root/LUM/
Code: Select all
/root/LUM/lum.sh SCAN
Code: Select all
ls -al /root/LUM/
Code: Select all
/root/LUM/lum.sh SCAN
If you have no other suggestions then I'll chalk this up to a weird system issue. I've seen other indicators of things not working when they should on it as well, so I don't think it's necessarily a problem with the script or file. BUT if you have any other ideas (since I am most certainly not a Linux guru) then I would be all ears.#ls -al /root/LUM/
total 12
drwxr-xr-x 2 root root 4096 Jul 12 08:28 .
drwx------ 6 root root 4096 Jul 12 07:59 ..
-rwxrwxrwx 1 root root 2553 Jul 12 08:28 lum.sh
#/root/LUM/lum.sh SCAN
sh: 1: /root/LUM/lum.sh: not found
Code: Select all
cat /root/LUM/lum.sh
Code: Select all
cp /root/LUM/lum.sh /var/tmp/
Code: Select all
/var/tmp/lum.sh SCAN
File copied to tmp:#cat /root/LUM/lum.sh
#!/usr/bin/bash
#----------------------------------------------------------
# Linux Update Manager
# desc: This script is used with the Linux Update Manager tool
# This tools scans for packages
# needing updates and the status of the linux host.
#
scriptVersion=1.0.25
#
#
#---------------------------------------------------------
if [ $EUID -ne 0 ]; then
echo "ERROR: Must be run as root"
exit 1
fi
deb=(ubuntu debian raspbian kali linuxmint)
rhe=(fedora rocky centos rhel amzn arch opensuse)
distroID=$(. /etc/os-release; echo $ID)
distroIDLIKE=$(. /etc/os-release; echo $ID_LIKE)
PM="apt"
if [[ " ${deb[*]} " =~ " ${distroID} " ]]; then
PM="apt"
elif [[ " ${deb[*]} " =~ " ${distroIDLIKE} " ]]; then
PM="apt"
elif [[ " ${rhe[*]} " =~ " ${distroID} " ]]; then
PM="yum"
else
PM="yum"
fi
CMD=$1
REBOOT=0
if [[ "$CMD" == *"SCAN"* ]]; then
if [[ "$PM" == *"apt"* ]]; then
a=$(apt-get --just-print upgrade 2>&1 | perl -ne 'if (/Inst\s([\w,\-,\d,\.,~,:,\ ] )\s\[([\w,\-,\d,\.,~,:,\ ] )\]\s\(([\w,\-,\d,\.,~,:,\ ] )\)? /i){print "\(\"39\", \"8423\", \"$1\", \"$2\", \"$3\"),"}')
elif [[ "$PM" == *"yum"* ]]; then
update=$(yum check-update)
installed=$(yum list installed)
a=$(awk 'BEGIN {FS=OFS=" "} NR==FNR {v[$1]=$2; next} {print (v[$1] ? "(\"39\",\"8423\", \"" $1 "\",\"" $2 "\",\"" v[$1] "\")," : "")}' <(echo "$update") <(echo "$installed") | column -t)
else
exit 1
fi
echo -n $a | sed 's/.$//'
elif [[ "$CMD" == *"TESTREBOOT"* ]] ; then
if [[ "$PM" == *"apt"* ]]; then
PM="apt"
PMV=$(apt -v |awk '{print $2}')
if [ -f /var/run/reboot-required ]; then
REBOOT=1
fi
elif [[ "$PM" == *"yum"* ]]; then
PM="yum"
PMV=$(yum list installed | grep yum.noarch | awk '{print $2}')
if ! command -v needs-restarting &> /dev/null
then
yum install yum-utils -y
fi
TESTREBOOT=$(needs-restarting -r)
if [[ $TESTREBOOT == *"Reboot is probably not necessary"* ]]; then
REBOOT=0
else
REBOOT=1
fi
else
exit 1
fi
ba='("39", "8423", "STG-COLO-UNMS", "Scout", "'$REBOOT'", "'$PM'", "'$PMV'",NOW())'
echo -n "$ba"
elif [[ "$CMD" == *"UPDATE"* ]] ; then
if [[ "$PM" == *"apt"* ]]; then
PM="apt"
apt-get update
apt-get upgrade -y
exit 0
elif [[ "$PM" == "yum" ]]; then
PM="yum"
yum check-update
yum update -y
exit 0
else
exit 1
fi
else
exit 1
fi
However, trying to execute from tmp gives the same "not found" error:#cp /root/LUM/lum.sh /var/tmp/
OK
I'm guess the problem is not that the file exists but that it simply doesn't want to execute due to some other weird system issue, but the error message is misleading. To my knowledge we don't have any special security software on this device, but it was something of a custom build so I'll check with the guy that deployed it to see if he might have any insight.#/var/tmp/lum.sh SCAN
sh: 1: /var/tmp/lum.sh: not found