~ubuntu-branches/ubuntu/natty/otrs2/natty-updates

« back to all changes in this revision

Viewing changes to bin/Cron.sh

  • Committer: Package Import Robot
  • Author(s): Torsten Werner
  • Date: 2007-04-14 17:58:55 UTC
  • mto: (20.1.1 squeeze)
  • mto: This revision was merged to the branch mainline in revision 6.
  • Revision ID: package-import@ubuntu.com-20070414175855-9ne0w01yu1q44ch0
Tags: upstream-2.1.7
ImportĀ upstreamĀ versionĀ 2.1.7

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/bin/sh
2
2
# --
3
3
# Cron.sh - start|stop OTRS Cronjobs
4
 
# Copyright (C) 2001-2005 Martin Edenhofer <martin+code@otrs.org>
 
4
# Copyright (C) 2001-2006 OTRS GmbH, http://otrs.org/
5
5
# --
6
 
# $Id: Cron.sh,v 1.11 2005/01/11 23:22:45 martin Exp $
 
6
# $Id: Cron.sh,v 1.13 2006/10/03 14:36:02 mh Exp $
7
7
# --
8
8
# This program is free software; you can redistribute it and/or modify
9
9
# it under the terms of the GNU General Public License as published by
26
26
CRON_USER=""
27
27
 
28
28
if test $CURRENTUSER = root; then
29
 
  echo "Run this script just as OTRS user! Or use 'Cron.sh {start|stop|restart} OTRS_USER'!"
30
 
  exit 5
 
29
    echo "Run this script just as OTRS user! Or use 'Cron.sh {start|stop|restart} OTRS_USER'!"
 
30
    exit 5
31
31
fi
32
32
 
33
33
# find otrs root
43
43
CRON_DIR=$OTRS_ROOT/var/cron
44
44
CRON_TMP_FILE=$OTRS_ROOT/var/tmp/otrs-cron-tmp.$$
45
45
 
46
 
echo "Cron.sh - start/stop OTRS cronjobs - <\$Revision: 1.11 $> "
47
 
echo "Copyright (c) 2001-2005 Martin Edenhofer <martin@otrs.org>"
 
46
echo "Cron.sh - start/stop OTRS cronjobs - <\$Revision: 1.13 $> "
 
47
echo "Copyright (C) 2001-2006 OTRS GmbH, http://otrs.org/"
48
48
 
49
49
#
50
50
# main part
54
54
    # start
55
55
    # ------------------------------------------------------
56
56
    start)
57
 
      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
58
 
        rm -rf $CRON_TMP_FILE
59
 
        echo "(using $OTRS_ROOT) done";
60
 
        exit 0;
61
 
      else
62
 
        echo "failed";
63
 
        exit 1;
64
 
      fi
 
57
        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
 
58
            rm -rf $CRON_TMP_FILE
 
59
            echo "(using $OTRS_ROOT) done";
 
60
            exit 0;
 
61
        else
 
62
            echo "failed";
 
63
            exit 1;
 
64
        fi
65
65
    ;;
66
66
    # ------------------------------------------------------
67
67
    # stop
68
68
    # ------------------------------------------------------
69
69
    stop)
70
 
      if crontab $CRON_USER -r ; then
71
 
        echo "done";
72
 
        exit 0;
73
 
      else
74
 
        echo "failed";
75
 
        exit 1;
76
 
      fi
 
70
        if crontab $CRON_USER -r ; then
 
71
            echo "done";
 
72
            exit 0;
 
73
        else
 
74
            echo "failed";
 
75
            exit 1;
 
76
        fi
77
77
    ;;
78
78
    # ------------------------------------------------------
79
79
    # restart
80
80
    # ------------------------------------------------------
81
81
    restart)
82
 
      $0 stop
83
 
      $0 start
 
82
        $0 stop
 
83
        $0 start
84
84
    ;;
85
85
    # ------------------------------------------------------
86
86
    # Usage
90
90
    exit 1
91
91
esac
92
92
 
93