[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Anacron-Script für User (Was: brauche ich die Dateien in /var/log/ksymoops ? = 167MB!)



Hallo Elmar,

On Fri, 18 Jul 2003 13:03:23 +0200
"Elmar W. Tischhauser" <tischhau@rbg.informatik.tu-darmstadt.de> wrote:

> Hallo!
> 
> On 18 Jul 2003 at 11:25 +0200, Alexander Fieroch wrote:
> 
> > Eine Kurze Frage habe ich aber noch:
> > Wird anacron jetzt immer beim booten geladen, also automatisch 
> > ausgeführt oder muss ich anacron manuell aufrufen?
> 
> Was anacron nicht oder nur über Umwege kann, ist das periodische
> Ausführen benutzerspezifischer Cron-Einträge. Da wäre dann fcron einen
> Versuch wert.

ich habe das mit folgendem Script gelöst (/usr/local/bin/anacron4user):
--- cut ---
#!/bin/bash

fullpath=`dirname $0`
cron_x=`basename $fullpath`

userid=`grep "^users:" /etc/group | cut -d ":" -f 3`
users=`grep "^[-a-z0-9_][-a-z0-9_]*:x:[0-9][0-9]*:$userid:" /etc/passwd \
	   | cut -d ":" -f 1`

for user in $users;
do
	userpath=`grep "^$user:" /etc/passwd | cut -d ":" -f 6`
	if [ -d $userpath/$cron_x ]; then
		/bin/su - $user "/usr/bin/nice \
			/bin/run-parts --report $userpath/$cron_x" \
		2>&1 | mailx -s "anacron: $cron_x for $user" $user@localhost
	fi
done
--- cut ---

In jedem Verzeichnis /etc/cron.??* liegt dann nur noch ein Symlink auf
/usr/local/bin/anacron4user


Gruß
  Jörg

-- 
Jörg Schütter           http://www.lug-untermain.de/
                        http://www.schuetter.org/joerg/
joerg@schuetter.org     http://mypenguin.bei.t-online.de/



Reply to: