blob: 9c31b30a5674c9d48e84d8ec0b1e706736580492 [file] [log] [blame]
Rodolfo Alonso Hernandezd1c2bf52022-11-02 16:43:41 +01001#!/bin/bash
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may
4# not use this file except in compliance with the License. You may obtain
5# a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations
13# under the License.
14
15set -o errexit
16
17# time to sleep between checks
18SLEEP_TIME=20
19
20function tracker {
21 echo "Number of open files | Number of open files not in use | Maximum number of files allowed to be opened"
22 while true; do
23 cat /proc/sys/fs/file-nr
24 sleep $SLEEP_TIME
25 done
26}
27
28function usage {
29 echo "Usage: $0 [-x] [-s N]" 1>&2
30 exit 1
31}
32
33while getopts ":s:x" opt; do
34 case $opt in
35 s)
36 SLEEP_TIME=$OPTARG
37 ;;
38 x)
39 set -o xtrace
40 ;;
41 *)
42 usage
43 ;;
44 esac
45done
46
47tracker