diff --git a/fluent-package/apt/systemd-test/install-newly.sh b/fluent-package/apt/systemd-test/install-newly.sh index 3b53c4b01..aeea145d4 100755 --- a/fluent-package/apt/systemd-test/install-newly.sh +++ b/fluent-package/apt/systemd-test/install-newly.sh @@ -24,9 +24,23 @@ test -e /var/log/fluent/fluentd.log (! grep -q -e '\[warn\]' -e '\[error\]' -e '\[fatal\]' /var/log/fluent/fluentd.log) # Test: Guard duplicated instance -(! sudo /usr/sbin/fluentd) -(! sudo /usr/sbin/fluentd -c /etc/fluent/fluentd.conf) -(! sudo /opt/fluent/bin/fluentd -c /etc/fluent/fluentd.conf) +ps -ef +COMMANDS=" +/usr/sbin/fluentd +/usr/sbin/fluentd -c /etc/fluent/fluentd.conf +/opt/fluent/bin/fluentd -c /etc/fluent/fluentd.conf +" +for com in $COMMANDS; do + timeout 5 --preserve-status sudo $com + if [ $? -eq 2 ]; then + echo "Successfully blocked launching duplicated Fluentd instance: $com" + else + echo "Error: failed to block launching duplicated Fluentd instance: $com" + fi +done +#(! sudo /usr/sbin/fluentd) +#(! sudo /usr/sbin/fluentd -c /etc/fluent/fluentd.conf) +#(! sudo /opt/fluent/bin/fluentd -c /etc/fluent/fluentd.conf) sudo apt remove -y fluent-package diff --git a/fluent-package/apt/systemd-test/update-from-v4.sh b/fluent-package/apt/systemd-test/update-from-v4.sh index a6cf96cd4..fa3a00a52 100755 --- a/fluent-package/apt/systemd-test/update-from-v4.sh +++ b/fluent-package/apt/systemd-test/update-from-v4.sh @@ -80,10 +80,21 @@ test -e /var/log/fluent/fluentd.log (! grep -e '\[error\]' -e '\[fatal\]' /var/log/fluent/fluentd.log) # Test: Guard duplicated instance -(! sudo /usr/sbin/fluentd) -(! sudo /usr/sbin/td-agent) -(! sudo /usr/sbin/fluentd -c /etc/fluent/fluentd.conf) -(! sudo /opt/fluent/bin/fluentd -c /etc/fluent/fluentd.conf) +ps -ef +COMMANDS=" +/usr/sbin/fluentd +/usr/sbin/td-agent +/usr/sbin/fluentd -c /etc/fluent/fluentd.conf +/opt/fluent/bin/fluentd -c /etc/fluent/fluentd.conf +" +for com in $COMMANDS; do + timeout 5 --preserve-status sudo $com + if [ $? -eq 2 ]; then + echo "Successfully blocked launching duplicated Fluentd instance: $com" + else + echo "Error: failed to block launching duplicated Fluentd instance: $com" + fi +done # Uninstall sudo apt remove -y fluent-package diff --git a/fluent-package/apt/systemd-test/update-to-next-version.sh b/fluent-package/apt/systemd-test/update-to-next-version.sh index 389194242..55d5ebfa8 100755 --- a/fluent-package/apt/systemd-test/update-to-next-version.sh +++ b/fluent-package/apt/systemd-test/update-to-next-version.sh @@ -45,10 +45,25 @@ test -e /var/log/fluent/fluentd.log (! grep -q -e '\[warn\]' -e '\[error\]' -e '\[fatal\]' /var/log/fluent/fluentd.log) # Test: Guard duplicated instance -(! sudo /usr/sbin/fluentd) -(! sudo /usr/sbin/td-agent) -(! sudo /usr/sbin/fluentd -c /etc/fluent/fluentd.conf) -(! sudo /opt/fluent/bin/fluentd -c /etc/fluent/fluentd.conf) +ps -ef +COMMANDS=" +/usr/sbin/fluentd +/usr/sbin/td-agent +/usr/sbin/fluentd -c /etc/fluent/fluentd.conf +/opt/fluent/bin/fluentd -c /etc/fluent/fluentd.conf +" +for com in $COMMANDS; do + timeout 5 --preserve-status sudo $com + if [ $? -eq 2 ]; then + echo "Successfully blocked launching duplicated Fluentd instance: $com" + else + echo "Error: failed to block launching duplicated Fluentd instance: $com" + fi +done +#(! sudo /usr/sbin/fluentd) +#(! sudo /usr/sbin/td-agent) +#(! sudo /usr/sbin/fluentd -c /etc/fluent/fluentd.conf) +#(! sudo /opt/fluent/bin/fluentd -c /etc/fluent/fluentd.conf) # Uninstall sudo apt remove -y fluent-package