ls -l --time-style=long-iso filename | cut -d ' ' -f6-7
name=`stat -c %y /etc/postfix/virtual | cut -f2 -d' ' | cut -c1-8`
echo $name
14:22:10
ls -l --time-style=long-iso virtual | cut -d ' ' -f6-7
2008-12-03 14:22
#!/bin/bash
ksvirtusertable=`stat -c %y /etc/postfix/ksvirtusertable | cut -f2 -d' ' | cut -c1-8`
ksvirtusertable_db=`stat -c %y /etc/postfix/ksvirtusertable.db | cut -f2 -d' ' | cut -c1-8`
echo $ksvirtusertable
if [`$ksvirtusertable` -gt `$ksvirtusertable_db`]
then
exit
echo "gleich"
else
echo "ungleich"
fi
00:07:01
00:07:40
./test: line 10: 00:07:01: command not found
./test: line 10: 00:07:40: command not found
if [`$ksvirtusertable` -gt `$ksvirtusertable_db`]
if [$ksvirtusertable -gt $ksvirtusertable_db]
./test: line 9: [00:07:01: command not found
ungleich
if [$ksvirtusertable = $ksvirtusertable_db]
name=`stat -c %y /etc/postfix/virtual | cut -f2 -d' ' | cut -c1-8`
if [ `date +%r -r/etc/postfix/virtual` != `date +%r -r/etc/postfix/virtual.db` ] ; then
echo -n "un"
fi
echo "gleich"
if [ /etc/postfix/virtual -nt /etc/postfix/virtual.db ] ; then
echo "need to update db"
fi
[B]#vi /root/cronjobs/email_adressen_abgleichen[/B]
#!/bin/bash
if [ `/bin/date +%r -r/etc/postfix/localdomains` != `/bin/date +%r -r/etc/postfix/localdomains.db` ] ;
then
/usr/sbin/postmap /etc/postfix/localdomains
/usr/bin/find /etc/postfix/ -name localdomains -exec /usr/bin/touch -r /etc/postfix/localdomains.db {} \;
echo "localdomains abgeglichen"
fi
if [ `/bin/date +%r -r/etc/postfix/virtusertable` != `/bin/date +%r -r/etc/postfix/virtusertable.db` ] ;
then
/usr/sbin/postmap /etc/postfix/virtusertable
/usr/bin/find /etc/postfix/ -name virtusertable -exec /usr/bin/touch -r /etc/postfix/virtusertable.db {} \;
echo "virtusertable abgeglichen"
fi
[B]#crontab -e[/B]
*/1 * * * * /root/cronjobs/email_adressen_abgleichen
chmod +x /root/cronjobs/email_adressen_abgleichen
/root/cronjobs/email_adressen_abgleichen: line 2: [: too many arguments
/root/cronjobs/email_adressen_abgleichen: line 10: [: too many arguments
find /etc/postfix/ -name virtusertable -exec touch -r /etc/postfix/main.cf {} \;
find /etc/postfix/ -name localdomains -exec touch -r /etc/postfix/main.cf {} \;
#!/bin/sh
#
# paranoia settings
#
umask 022
PATH=/sbin:/bin:/usr/sbin:/usr/bin
export PATH
if [ -f /etc/sysconfig/wasauchimmer ] ; then
. /etc/sysconfig/wasauchimmer
fi
#! /bin/sh
# Copyright (c) 1997-2001 SuSE GmbH Nuernberg, Germany.
# Author: Florian La Roche
# Werner Fink <feedback@suse.de>
[...]
test -e /etc/mail/virtusertable && \
if test /etc/mail/virtusertable -nt /etc/mail/virtusertable.db \
-o ! -e /etc/mail/virtusertable.db ; then
echo "Rebuilding /etc/mail/virtusertable.db."
makemap hash ${nofold} /etc/mail/virtusertable.db < /etc/mail/virtusertable
test -e /etc/mail/virtusertable.db && touch /etc/mail/virtusertable.db
fi
[...]
Gar keins. Und du willst dich in die Grundlagen des Shellscriptings einlesen. Wenn du das gemacht hast, willst du den ABS lesen.Was für ein Problem hat Cron denn hier ?
`/bin/date +%r -r/etc/postfix/localdomains`
#!/bin/bash
umask 022
PATH=/sbin:/bin:/usr/sbin:/usr/bin
export PATH
kslocaldomains=`date +%r -r/etc/postfix/kslocaldomains`
kslocaldomains_db=`date +%r -r/etc/postfix/kslocaldomains.db`
ksvirtusertable=`date +%r -r/etc/postfix/ksvirtusertable`
ksvirtusertable_db=`date +%r -r/etc/postfix/ksvirtusertable.db`
if [ "$kslocaldomains" != "$kslocaldomains_db" ];
then
postmap /etc/postfix/kslocaldomains
find /etc/postfix/ -name kslocaldomains -exec touch -r /etc/postfix/kslocaldomains.db {} \;
echo "kslocaldomains abgeglichen"
fi
if [ "$ksvirtusertable" != "$ksvirtusertable_db" ];
then
postmap /etc/postfix/ksvirtusertable
find /etc/postfix/ -name ksvirtusertable -exec touch -r /etc/postfix/ksvirtusertable.db {} \;
echo "ksvirtusertable abgeglichen"
fi
We use essential cookies to make this site work, and optional cookies to enhance your experience.