blob: 25c8e9a83f5e37c063f9ee05abb6c8175adcf0cb [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 {
Vasyl Saienko9f2f4992025-02-28 07:47:11 +000022 mkdir -p $LOGDIR/atop
23 cat <<EOF | sudo tee /etc/default/atop >/dev/null
Vasyl Saienko1aac81e2025-01-18 08:40:51 +000024# /etc/default/atop
25# see man atoprc for more possibilities to configure atop execution
26
27LOGOPTS="-R"
28LOGINTERVAL=${ATOP_LOGINTERVAL:-"30"}
29LOGGENERATIONS=${ATOP_LOGGENERATIONS:-"1"}
30LOGPATH=$LOGDIR/atop
31EOF
32}
33
34function install_atop {
35 install_package atop
36}
37
38# start_() - Start running processes
39function start_atop {
40 start_service atop
41}
42
43# stop_atop() stop atop process
44function stop_atop {
45 stop_service atop
46}
47
48# Restore xtrace
49$_XTRACE_ATOP