Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
scripts
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
webarch
scripts
Commits
ba8760a5
Commit
ba8760a5
authored
Oct 05, 2019
by
Chris Croome
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Checks added to Kate's bandwidth script
parent
4756ee01
Pipeline
#7445
passed with stage
in 21 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
1 deletion
+13
-1
bin/apache_data_usage_by_user
bin/apache_data_usage_by_user
+13
-1
No files found.
bin/apache_data_usage_by_user
View file @
ba8760a5
...
...
@@ -5,12 +5,24 @@ logfiles=/var/log/apache2/
rcpts
=
"
$1
"
host
=
$(
hostname
-f
)
# Make a private TMP directory for data processing
if
[[
!
-d
"
${
data_tmp
}
"
]]
;
then
mkdir
-p
"
${
data_tmp
}
"
fi
chmod
700
"
${
data_tmp
}
"
# Check for email address as first argument
if
[[
!
"
${
1
}
"
]]
;
then
echo
"Please supply an email address as the first argument"
exit
1
fi
# Identify users.
## Do this by looking at apache configuration and using that to build a list of users
## Why this way ... well it's apache we need to be thinking about ? so it seems as good an
## any other way to do it
users
=
$(
grep
AssignUserID /etc/apache2/sites-available/
*
conf |
awk
'{print $3}'
|
sort
|
uniq
)
users
=
$(
ls
/etc/apache2/sites-enabled/
*
conf |
sed
's;^/etc/apache2/sites-enabled/;;'
|
sed
's/\.conf$//'
|
sort
|
uniq
)
report
=
"User RX_GiBYTES TX_GiBYTES TOTAL_GiBYTES
\n
-----------------------
\n
"
for
user
in
$users
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment