Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exit bash API-download script immediately if sensor is already running #174

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions Agent-Install-Examples/bash/API-download/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,24 @@ main() {
print_usage
exit 1
fi

echo -n 'Falcon Sensor Install ... '; cs_sensor_install; echo '[ Ok ]'
echo -n 'Falcon Sensor Register ... '; cs_sensor_register; echo '[ Ok ]'
echo -n 'Falcon Sensor Restart ... '; cs_sensor_restart; echo '[ Ok ]'
echo 'Falcon Sensor deployed successfully.'
}

cs_sensor_exit_if_sensor_running() {
if type service >/dev/null 2>&1; then
service falcon-sensor status >/dev/null 2>&1
elif type systemctl >/dev/null 2>&1; then
systemctl -q is-active falcon-sensor
fi
if [ $? -eq 0 ]; then
exit 0;
fi
}

cs_sensor_register() {
/opt/CrowdStrike/falconctl -s -f --cid="${cs_falcon_cid}"
}
Expand Down Expand Up @@ -303,6 +315,8 @@ EOF
}


cs_sensor_exit_if_sensor_running;

set -e


Expand Down