Vasyl Saienko | 1aac81e | 2025-01-18 08:40:51 +0000 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # |
| 3 | # lib/atop |
| 4 | # Functions to start and stop atop |
| 5 | |
| 6 | # Dependencies: |
| 7 | # |
| 8 | # - ``functions`` file |
| 9 | |
| 10 | # ``stack.sh`` calls the entry points in this order: |
| 11 | # |
| 12 | # - configure_atop |
| 13 | # - install_atop |
| 14 | # - start_atop |
| 15 | # - stop_atop |
| 16 | |
| 17 | # Save trace setting |
| 18 | _XTRACE_ATOP=$(set +o | grep xtrace) |
| 19 | set +o xtrace |
| 20 | |
| 21 | function configure_atop { |
Vasyl Saienko | 9f2f499 | 2025-02-28 07:47:11 +0000 | [diff] [blame] | 22 | mkdir -p $LOGDIR/atop |
| 23 | cat <<EOF | sudo tee /etc/default/atop >/dev/null |
Vasyl Saienko | 1aac81e | 2025-01-18 08:40:51 +0000 | [diff] [blame] | 24 | # /etc/default/atop |
| 25 | # see man atoprc for more possibilities to configure atop execution |
| 26 | |
| 27 | LOGOPTS="-R" |
| 28 | LOGINTERVAL=${ATOP_LOGINTERVAL:-"30"} |
| 29 | LOGGENERATIONS=${ATOP_LOGGENERATIONS:-"1"} |
| 30 | LOGPATH=$LOGDIR/atop |
| 31 | EOF |
| 32 | } |
| 33 | |
| 34 | function install_atop { |
| 35 | install_package atop |
| 36 | } |
| 37 | |
| 38 | # start_() - Start running processes |
| 39 | function start_atop { |
| 40 | start_service atop |
| 41 | } |
| 42 | |
| 43 | # stop_atop() stop atop process |
| 44 | function stop_atop { |
| 45 | stop_service atop |
| 46 | } |
| 47 | |
| 48 | # Restore xtrace |
| 49 | $_XTRACE_ATOP |