Skip to content

Commit

Permalink
exit bash API-download script immediately if sensor is already running
Browse files Browse the repository at this point in the history
Makes the script do nothing if the sensor is already installed and running.
This makes it more suitable to run from AWS SSM State Manager.
  • Loading branch information
joekohlsdorf authored and joekohlsdorf committed Aug 25, 2022
1 parent dd38ad6 commit ca539ad
Showing 1 changed file with 14 additions and 0 deletions.
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

0 comments on commit ca539ad

Please sign in to comment.