]>
Commit | Line | Data |
---|---|---|
44cc9a3d MT |
1 | #!/bin/sh |
2 | ######################################################################## | |
3 | # Begin $rc_base/init.d/amazon-ssm-agent | |
4 | ######################################################################## | |
5 | ||
6 | . /etc/sysconfig/rc | |
7 | . ${rc_functions} | |
8 | ||
9 | case "${1}" in | |
10 | start) | |
11 | # Do not launch the agent when we are not running on EC2 | |
12 | if ! running_on_ec2; then | |
13 | exit 0 | |
14 | fi | |
15 | ||
0c466599 MT |
16 | # Allow the kernel to overcommit memory. |
17 | # The SSM agent fails to clone() itself when there is | |
18 | # "not enough memory" available. This simply seems to | |
19 | # fail no matter how much free memory is available. | |
20 | echo 1 > /proc/sys/vm/overcommit_memory | |
21 | ||
44cc9a3d MT |
22 | boot_mesg "Starting Amazon SSM Agent..." |
23 | /usr/bin/amazon-ssm-agent &>/dev/null & | |
24 | evaluate_retval | |
25 | ;; | |
26 | ||
27 | stop) | |
28 | boot_mesg "Stopping Amazon SSM Agent..." | |
29 | killproc /usr/bin/amazon-ssm-agent | |
30 | ;; | |
31 | ||
32 | restart) | |
33 | ${0} stop | |
34 | sleep 1 | |
35 | ${0} start | |
36 | ;; | |
37 | ||
38 | status) | |
39 | statusproc /usr/bin/amazon-ssm-agent | |
40 | ;; | |
41 | ||
42 | *) | |
43 | echo "Usage: ${0} {start|stop|restart|status}" | |
44 | exit 1 | |
45 | ;; | |
46 | esac | |
47 | ||
48 | # End $rc_base/init.d/amazon-ssm-agent |