# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
description "Autotest Suite scheduler"
start on (starting network-interface
          or starting network-manager
          or starting networking)

start on runlevel [2345]
stop on runlevel [!2345]

script
  # Uncomment for debugging
  # exec > /tmp/suite-scheduler-start.log 2>&1
  USER="chromeos-test"
  AUTOTEST_DIR="/usr/local/autotest"
  LOGGING_DIR="${AUTOTEST_DIR}/logs"
  SCHEDULER_DIR="${AUTOTEST_DIR}/site_utils/suite_scheduler"
  SCHEDULER_COMMAND="suite_scheduler.py"
  SCHEDULER_ARGS="${SCHEDULER_ARGS} -d ${LOGGING_DIR} -f ${AUTOTEST_DIR}/suite_scheduler.ini"

  exec sudo -u ${USER} ${SCHEDULER_DIR}/${SCHEDULER_COMMAND} ${SCHEDULER_ARGS}
end script

respawn
