Howto: Clean Class Shares at the end of the school period

Howto clean class shares at the end of the school period

In ucs@school class shares are not cleaned automatically. This is because there might be files which are worth to be saved (i.e. by teachers).
In case you want to clean all shares you might do this manually by the help of a script.

Step 1

Create a bash script named cleanup_classes.sh as follows:

#!/bin/bash
cd /home/$(ucr get samba4/join/site)/groups/klassen || exit 255
for i in $(find  . -maxdepth 1 -type d| grep -v " "); do
   pushd $i && rm -rf *
   popd
done

Step 2

Mark this script executalbe:
chmod +x cleanup_classes.sh

Step 3

Start the script: ./cleanup_classes.sh.
Note: This will wipe every content under the classes shares directories!

1 Like

This topic was automatically closed after 24 hours. New replies are no longer allowed.

Mastodon