
Hi Robert, thanks for the patch. Anyway, I'm not sure if "getent" is available on all unix platforms. So IMO it's better to use the old script. Or knows anybody if "getent" is also available on SunOS, FreeDSB, AIX, ...? Thanks, Martin Edenhofer -- ((otrs.de)) :: OTRS GmbH :: Norsk-Data-Str. 1 :: 61352 Bad Homburg http://www.otrs.de/ :: Manage your communication! Robert Kehl wrote:
Hello all!
I've written a patch to Cron.sh to actually allow using the OTRS_USER option. Additionally, enumerating the available cron jobs gets improved. The patch is attached and available under: http://wiki.robertkehl.de/index.pl?PatchImproveOtrsCron
With kind regards,
Robert Kehl
------------------------------------------------------------------------
--- bin/Cron.sh +++ bin/Cron.sh @@ -21,17 +21,19 @@ # --
CURRENTUSER=`whoami` -OTRS_HOME=$HOME -#CRON_USER=" -u $RUNASUSER "; -CRON_USER=""
-if test $CURRENTUSER = root; then +if test "$CURRENTUSER" == 'root'; then + if test "$2" == ""; then echo "Run this script just as OTRS user! Or use 'Cron.sh {start|stop|restart} OTRS_USER'!" exit 5 + else + su - $2 -c $0 $1 + exit + fi fi
# find otrs root -#OTRS_ROOT=/opt/OpenTRS +OTRS_HOME=`getent passwd $CURRENTUSER | awk -F: '{ print $6 }'` if test -e $OTRS_HOME/var/cron; then OTRS_ROOT=$OTRS_HOME else @@ -54,7 +56,7 @@ # start # ------------------------------------------------------ start) - if mkdir -p $CRON_DIR; cd $CRON_DIR && ls * |grep -v '.dist'|grep -v '.rpm'| grep -v CVS | grep -v Entries | grep -v Repository | grep -v Root | xargs cat > $CRON_TMP_FILE && crontab $CRON_USER $CRON_TMP_FILE; then + if mkdir -p $CRON_DIR && find $CRON_DIR ! -name *.dist ! -name *.rpm ! -path "*/CVS/*" -type f | xargs cat > $CRON_TMP_FILE && crontab $CRON_TMP_FILE; then rm -rf $CRON_TMP_FILE echo "(using $OTRS_ROOT) done"; exit 0;
------------------------------------------------------------------------
_______________________________________________ OTRS mailing list: dev - Webpage: http://otrs.org/ Archive: http://lists.otrs.org/pipermail/dev To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/dev