Add scan cronjob to test

This commit is contained in:
Micke Nordin 2025-02-26 10:32:07 +01:00
parent a4a9e492f5
commit fc0a790bd1
Signed by untrusted user: Micke
GPG key ID: 0DA0A7A5708FE257
2 changed files with 26 additions and 0 deletions

View file

@ -97,6 +97,22 @@ define sunetdrive::app_type (
content => template('sunetdrive/application/get_containers'),
mode => '0744',
}
if ($environment == 'test') {
file { '/usr/local/bin/scan_external_mounts':
ensure => present,
force => true,
owner => 'root',
group => 'root',
content => template('sunetdrive/application/scan_external_mounts.sh'),
mode => '0744',
}
cron { 'scan_external_mounts':
command => '/usr/local/bin/scan_external_mounts',
user => 'root',
minute => '42',
hour => '9',
}
}
unless $is_multinode{
user { 'www-data': ensure => present, system => true }

View file

@ -0,0 +1,10 @@
#!/bin/bash
# Only run if this is the only instance of this script running
if [[ $(pgrep -f "${0}" | wc -l) -eq 1 ]]; then
for container in $(get_containers); do
for id in $(nocc "${container}" files_external:list --all --output json | jq '.[].mount_id' | jq .); do
nocc "${container}" files_external:scan "${id}"
done
done
fi