Simplified check and quoted string.

pull/481/head
Joe Prochazka 2018-10-04 10:34:58 -04:00
rodzic 7ec650c351
commit f72e83b6ef
1 zmienionych plików z 18 dodań i 20 usunięć

Wyświetl plik

@ -119,7 +119,7 @@ echo -e ""
# Check if the old style adsbexchange-maint.sh line exists in /etc/rc.local.
echo -e "\e[94m Checking for any preexisting older style setups...\e[97m"
if [[ `grep -cFx "$RECEIVER_BUILD_DIRECTORY/adsbexchange/adsbexchange-maint.sh &" /etc/rc.local` -gt 0 ]] ; then
if [ ! -z $(grep "$RECEIVER_BUILD_DIRECTORY/adsbexchange/adsbexchange-maint.sh" "/etc/rc.local") ]; then
# Kill any currently running instances of the adsbexchange-maint.sh script.
echo -e "\e[94m Checking for any running adsbexchange-maint.sh processes...\e[97m"
PIDS=`ps -efww | grep -w "$RECEIVER_BUILD_DIRECTORY/adsbexchange/adsbexchange-maint.sh &" | awk -vpid=$$ '$2 != pid { print $2 }'`
@ -132,28 +132,26 @@ if [[ `grep -cFx "$RECEIVER_BUILD_DIRECTORY/adsbexchange/adsbexchange-maint.sh &
fi
# Remove the old line from /etc/rc.local.
echo -e "\e[94m Removing the old adsbexchange--maint.sh startup line from /etc/rc.local...\e[97m"
sudo sed -i /$RECEIVER_BUILD_DIRECTORY\/adsbexchange\/adsbexchange-maint.sh &/d /etc/rc.local 2>&1
sudo sed -i '/$RECEIVER_BUILD_DIRECTORY\/adsbexchange\/adsbexchange-maint.sh &'/d /etc/rc.local 2>&1
fi
# Remove the depreciated adsbexchange-netcat_maint.sh script.
if [ -f /etc/rc.local ]; then
echo -e "\e[94m Checking if the netcat startup line is contained within the file /etc/rc.local...\e[97m"
if ! grep -Fxq "$RECEIVER_BUILD_DIRECTORY/adsbexchange/adsbexchange-netcat_maint.sh &" /etc/rc.local; then
# Kill any currently running instances of the adsbexchange-netcat_maint.sh script.
echo -e "\e[94m Checking for any running adsbexchange-netcat_maint.sh processes...\e[97m"
if [[ $(ps -aux | grep '[a]dsbexchange-netcat_maint.sh' | awk '{print $2}') ]]; then
echo -e "\e[94m Killing the current adsbexchange-netcat_maint.sh process...\e[97m"
sudo kill -9 $(ps -aux | grep '[a]dsbexchange-netcat_maint.sh' | awk '{print $2}') &> /dev/null
fi
if [[ $(ps -aux | grep '[f]eed.adsbexchange.com' | awk '{print $2}') ]]; then
echo -e "\e[94m Killing the current feed.adsbexchange.com process...\e[97m"
sudo kill -9 $(ps -aux | grep '[f]eed.adsbexchange.com' | awk '{print $2}') &> /dev/null
fi
# Remove the depreciated netcat script start up line.
if [ -f /etc/rc.local ]; then
echo -e "\e[94m Removing the netcat startup script line to the file /etc/rc.local...\e[97m"
sudo sed -i /$RECEIVER_BUILD_DIRECTORY\/adsbexchange\/adsbexchange-netcat_maint.sh &/d /etc/rc.local 2>&1
fi
echo -e "\e[94m Checking if the netcat startup line is contained within the file /etc/rc.local...\e[97m"
if [ ! -z $(grep "$RECEIVER_BUILD_DIRECTORY/adsbexchange/adsbexchange-netcat_maint.sh" "/etc/rc.local") ]; then
# Kill any currently running instances of the adsbexchange-netcat_maint.sh script.
echo -e "\e[94m Checking for any running adsbexchange-netcat_maint.sh processes...\e[97m"
if [[ $(ps -aux | grep '[a]dsbexchange-netcat_maint.sh' | awk '{print $2}') ]]; then
echo -e "\e[94m Killing the current adsbexchange-netcat_maint.sh process...\e[97m"
sudo kill -9 $(ps -aux | grep '[a]dsbexchange-netcat_maint.sh' | awk '{print $2}') &> /dev/null
fi
if [[ $(ps -aux | grep '[f]eed.adsbexchange.com' | awk '{print $2}') ]]; then
echo -e "\e[94m Killing the current feed.adsbexchange.com process...\e[97m"
sudo kill -9 $(ps -aux | grep '[f]eed.adsbexchange.com' | awk '{print $2}') &> /dev/null
fi
# Remove the depreciated netcat script start up line.
if [ -f /etc/rc.local ]; then
echo -e "\e[94m Removing the netcat startup script line to the file /etc/rc.local...\e[97m"
sudo sed -i '/$RECEIVER_BUILD_DIRECTORY\/adsbexchange\/adsbexchange-netcat_maint.sh &'/d /etc/rc.local 2>&1
fi
fi
echo -e ""