blob: e0b14cb0397110607cc359996734a52a9eba525e [file] [log] [blame]
Vasyl Saienko1aac81e2025-01-18 08:40:51 +00001#!/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)
19set +o xtrace
20
21function configure_atop {
22 cat <<EOF | sudo tee /etc/default/atop >/dev/null
23# /etc/default/atop
24# see man atoprc for more possibilities to configure atop execution
25
26LOGOPTS="-R"
27LOGINTERVAL=${ATOP_LOGINTERVAL:-"30"}
28LOGGENERATIONS=${ATOP_LOGGENERATIONS:-"1"}
29LOGPATH=$LOGDIR/atop
30EOF
31}
32
33function install_atop {
34 install_package atop
35}
36
37# start_() - Start running processes
38function start_atop {
39 start_service atop
40}
41
42# stop_atop() stop atop process
43function stop_atop {
44 stop_service atop
45}
46
47# Restore xtrace
48$_XTRACE_ATOP