Initial import
This commit is contained in:
commit
5f6c937b64
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/BAK/*
|
6
check_samba_rights.sh
Executable file
6
check_samba_rights.sh
Executable file
@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
(/root/bin/cleanup_samba_rights.sh <directory> <group>)
|
||||
..
|
||||
|
||||
exit 0
|
34
clean_trash.sh
Executable file
34
clean_trash.sh
Executable file
@ -0,0 +1,34 @@
|
||||
#!/bin/bash
|
||||
|
||||
trash_dirs="/data/buero/.Trash /data/ajur/.Trash /data/scan/.Trash /data/datev/.Trash"
|
||||
days=31
|
||||
|
||||
traverse() {
|
||||
|
||||
for file in `ls -a $1` ; do
|
||||
if [ -d $1/$file ] ; then
|
||||
[ "$1/$file" = "$1/.." ] && continue
|
||||
[ "$1/$file" = "$1/." ] && continue
|
||||
traverse $1/$file
|
||||
fi
|
||||
done
|
||||
|
||||
find $1 -type f -mtime +${days} -exec rm -f "{}" \;
|
||||
|
||||
## - leere Unterverzeichnisse löschen
|
||||
#find $1 -depth -mindepth 1 -type d -empty -exec rmdir "{}" \;
|
||||
|
||||
}
|
||||
|
||||
for dir in $trash_dirs ; do
|
||||
traverse "$dir"
|
||||
done
|
||||
|
||||
## - lösche leere (Unter-)Verzeichnisse
|
||||
## -
|
||||
for dir in $trash_dirs ; do
|
||||
#find $dir -depth -mindepth 2 -type d -empty -exec rmdir "{}" \;
|
||||
find $dir -depth -mindepth 2 -type d -empty -delete
|
||||
done
|
||||
|
||||
exit
|
28
cleanup_samba_rights.sh
Executable file
28
cleanup_samba_rights.sh
Executable file
@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
base_dir=$1
|
||||
group=$2
|
||||
dir_perm=2775
|
||||
#dir_perm="u=rwx,g=rwx,o=rx,g+s"
|
||||
file_perm=664
|
||||
|
||||
chmod $dir_perm $base_dir
|
||||
chgrp $group $base_dir
|
||||
|
||||
while IFS='' read -r -d '' filename ; do
|
||||
|
||||
[ -f "$filename" ] && ( chmod $file_perm "$filename"; chgrp $group $"$filename")
|
||||
[ ! -d "$filename" ] && continue
|
||||
|
||||
[ "$filename" = "lost+found" ] && continue
|
||||
|
||||
chmod $dir_perm "$filename" ; chgrp $group "$filename"
|
||||
|
||||
find "$filename" -exec chgrp -R $group {} \;
|
||||
find "$filename" -type d -exec chmod -R $dir_perm {} \;
|
||||
find "$filename" -type f -exec chmod -R $file_perm {} \;
|
||||
|
||||
|
||||
done < <(find $base_dir -mindepth 1 -maxdepth 1 -print0)
|
||||
|
||||
exit 0
|
Loading…
Reference in New Issue
Block a user