All pastes #467087 Raw Edit

mynullvoid

public text v1 · immutable
·published 2007-05-02 09:41 UTC
rendered paste body
===========================start============================
#!/bin/bash

thmo=$(date +'%Y.%m')

date > /tmp/proma.log

for userfol in $(grep ':1001:' /etc/passwd | awk -F':' '{print $1}')

do
   echo "Processing for user $userfol" >> /tmp/proma.log

   mailoc="/home/$userfol/Maildir"

      ls -Al $mailoc/{new,cur} | awk -F' ' '{print $6}' | sed -e '/^$/d' | awk -F'-' -v awkml="$mailoc" '{print "maildirmake -f " $1"."$2" "awkml}' | grep $thmo -v | sort -u | sh

      find $mailoc/new/ -type f -printf "mvp %h/%f $mailoc/.%TY.%Tm/new\n" | grep -v $thmo | sh
      find $mailoc/cur/ -type f -printf "mvp %h/%f $mailoc/.%TY.%Tm/cur\n" | grep -v $thmo | sh

echo "ls $mailoc/.[a-zA-Z0-9]* -ad1 | grep .Templates -v |sed 's/\/home\/$userfol\/Maildir\//INBOX/g' > $mailoc/courierimapsubscribed" | sh

chown $userfol:azrbstaff $mailoc -R

   echo "Done processing for user $userfol" >> /tmp/proma.log

done

date >> /tmp/proma.log

===========================end============================
#mvp file
#
#!/bin/bash

[[ -e "$1" ]] && cp -p "$1" "$2" && rm "$1"