Minor Fixes

This commit is contained in:
earnolmartin 2020-03-25 22:42:30 -06:00
parent 6ecdd7c083
commit 069290fd7a
3 changed files with 12 additions and 12 deletions

View file

@ -2858,17 +2858,17 @@ function searchForServiceName(){
fi
if [ ! -z "$1" ]; then
serviceName=$(ls /etc/init.d 2>/dev/null | grep -F -- "${1}")
serviceName=$(ls /etc/init.d 2>/dev/null | grep -F -- "${1}" | head -n 1)
if [ ! -z "$serviceName" ]; then
echo "${serviceName}" > "${serviceNameTempFile}"
fi
serviceName=$(find /lib/systemd/system -name "*${1}*" -exec basename {} .service \; 2>/dev/null)
serviceName=$(find /lib/systemd/system -name "*${1}*" -exec basename {} .service \; 2>/dev/null | head -n 1)
if [ ! -z "$serviceName" ]; then
echo "${serviceName}" > "${serviceNameTempFile}"
fi
serviceName=$(find /etc/systemd/system -name "*${1}*" -exec basename {} .service \; 2>/dev/null)
serviceName=$(find /etc/systemd/system -name "*${1}*" -exec basename {} .service \; 2>/dev/null | head -n 1)
if [ ! -z "$serviceName" ]; then
echo "${serviceName}" > "${serviceNameTempFile}"
fi

View file

@ -2476,17 +2476,17 @@ function searchForServiceName(){
fi
if [ ! -z "$1" ]; then
serviceName=$(ls /etc/init.d 2>/dev/null | grep -F -- "${1}")
serviceName=$(ls /etc/init.d 2>/dev/null | grep -F -- "${1}" | head -n 1)
if [ ! -z "$serviceName" ]; then
echo "${serviceName}" > "${serviceNameTempFile}"
fi
serviceName=$(find /lib/systemd/system -name "*${1}*" -exec basename {} .service \; 2>/dev/null)
serviceName=$(find /lib/systemd/system -name "*${1}*" -exec basename {} .service \; 2>/dev/null | head -n 1)
if [ ! -z "$serviceName" ]; then
echo "${serviceName}" > "${serviceNameTempFile}"
fi
serviceName=$(find /etc/systemd/system -name "*${1}*" -exec basename {} .service \; 2>/dev/null)
serviceName=$(find /etc/systemd/system -name "*${1}*" -exec basename {} .service \; 2>/dev/null | head -n 1)
if [ ! -z "$serviceName" ]; then
echo "${serviceName}" > "${serviceNameTempFile}"
fi

View file

@ -881,18 +881,18 @@ function serviceExists($service){
// Below command is too slow
// $serviceExists = shell_exec('service --status-all 2>&1 | grep -F -- "' . $service . '" | awk \'{print $4}\' | tr -d \'\n\'');
$serviceExists = shell_exec('ls /etc/init.d 2>/dev/null | grep -F -- "' . $service . '"');
$serviceExists = shell_exec('ls /etc/init.d 2>/dev/null | grep -F -- "' . $service . '" | head -n 1');
if(isset($serviceExists) && !empty($serviceExists)){
return true;
}
$serviceExists = shell_exec('find /lib/systemd/system -name "*' . $service . '*" -exec basename {} .service \; 2>/dev/null');
$serviceExists = shell_exec('find /lib/systemd/system -name "*' . $service . '*" -exec basename {} .service \; 2>/dev/null | head -n 1');
if(isset($serviceExists) && !empty($serviceExists)){
return true;
}
$serviceExists = shell_exec('find /etc/systemd/system -name "*' . $service . '*" -exec basename {} .service \; 2>/dev/null');
$serviceExists = shell_exec('find /etc/systemd/system -name "*' . $service . '*" -exec basename {} .service \; 2>/dev/null | head -n 1');
if(isset($serviceExists) && !empty($serviceExists)){
return true;
@ -905,19 +905,19 @@ function determinePHPFPMName(){
// Below command takes too long
// $serviceExists = shell_exec('service --status-all 2>&1 | grep -F -- "-fpm" | awk \'{print $4}\' | grep "php" | tr -d \'\n\'');
$serviceExists = shell_exec('ls /etc/init.d 2>/dev/null | grep -F -- "-fpm"');
$serviceExists = shell_exec('ls /etc/init.d 2>/dev/null | grep -F -- "-fpm" | head -n 1');
if(isset($serviceExists) && !empty($serviceExists) && stripos($serviceExists, 'php') !== false){
return $serviceExists;
}
$serviceExists = shell_exec('find /lib/systemd/system -name "*-fpm*" -exec basename {} .service \; 2>/dev/null');
$serviceExists = shell_exec('find /lib/systemd/system -name "*-fpm*" -exec basename {} .service \; 2>/dev/null | head -n 1');
if(isset($serviceExists) && !empty($serviceExists) && stripos($serviceExists, 'php') !== false){
return $serviceExists;
}
$serviceExists = shell_exec('find /etc/systemd/system -name "*-fpm*" -exec basename {} .service \; 2>/dev/null');
$serviceExists = shell_exec('find /etc/systemd/system -name "*-fpm*" -exec basename {} .service \; 2>/dev/null | head -n 1');
if(isset($serviceExists) && !empty($serviceExists) && stripos($serviceExists, 'php') !== false){
return $serviceExists;