2024-08-30 06:57:17 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2024-08-30 13:39:01 +00:00
|
|
|
<% basedir="statistics:drive-server-coms" -%>
|
|
|
|
<% cupath="/opt/mariadb/statistics/users/" -%>
|
|
|
|
|
2024-08-30 06:57:17 +00:00
|
|
|
<% @custdata.each do |cust,data| -%>
|
|
|
|
#Customer <%= cust %> has no billing departments.
|
|
|
|
<% if defined?(data[@environment]["billdomains"]) && data[@environment]["billdomains"] -%>
|
|
|
|
mkdir -p /opt/mariadb/statistics/users/<%= cust %>
|
|
|
|
chmod '0700' /opt/mariadb/statistics/users/<%= cust %>
|
|
|
|
<% data[@environment]["billdomains"].each do |dom| -%>
|
2024-08-30 13:39:01 +00:00
|
|
|
/root/tasks/listusersbydep.sh <%= cust %> <%= dom %> > /opt/mariadb/statistics/users/<%= cust %>/users-<%= dom.gsub(/[.]/, '-') %>.json
|
|
|
|
if jq . <%= cupath + cust %>/users-<%= dom.gsub(/[.]/, '-') %>.json &>/dev/null
|
|
|
|
then
|
|
|
|
timeout 30s rclone copy -c --no-check-certificate --webdav-headers "Host,sunet.drive.sunet.se" --use-cookies <%= cupath + cust %>/users-<%= dom.gsub(/[.]/, '-') %>.json <%= basedir%>/<%= cust %>-<%= @environment%>/
|
|
|
|
fi
|
2024-08-30 06:57:17 +00:00
|
|
|
<% end -%>
|
|
|
|
<% end -%>
|
|
|
|
<% end -%>
|