forked from OpenMage/magento-mirror
-
Notifications
You must be signed in to change notification settings - Fork 1
/
cron.sh
29 lines (26 loc) · 933 Bytes
/
cron.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/sh
# location of the php binary
if [ ! "$1" = "" ] ; then
CRONSCRIPT=$1
else
CRONSCRIPT=cron.php
fi
PHP_BIN=`which php`
# absolute path to magento installation
if [ "$1" != "" ]; then
INSTALLDIR=`ps axwww -o command= |grep -v grep| grep croncheck.sh \
| awk '{ field = $(NF-1) }; END{ print field }' | sed 's/croncheck\.sh//g'`
else
INSTALLDIR=`ps axwww -o command= |grep -v grep| grep croncheck.sh \
| awk '{ field = $NF }; END{ print field }' | sed 's/croncheck\.sh//g'`
fi
# prepend the intallation path if not given an absolite path
if [ "$INSTALLDIR" != "" -a "`expr index $CRONSCRIPT /`" != "1" ];then
if ! ps auxwww | grep "$INSTALLDIR""$CRONSCRIPT" | grep -v grep 1>/dev/null 2>/dev/null ; then
$PHP_BIN "$INSTALLDIR""$CRONSCRIPT" &
fi
else
if ! ps auxwww | grep " $CRONSCRIPT" | grep -v grep | grep -v croncheck.sh 1>/dev/null 2>/dev/null ; then
$PHP_BIN $CRONSCRIPT &
fi
fi