| # Copyright 2023 The ChromiumOS Authors |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| description "Sets system clock time for ARC Container." |
| author "chromium-os-dev@chromium.org" |
| |
| # service is not system critical |
| oom score -100 |
| task |
| |
| import UNIXTIME_TO_SET |
| |
| pre-start script |
| logger -t "${UPSTART_JOB}" "Pre-start arc-set-time" |
| |
| if ! echo "${UNIXTIME_TO_SET}" | grep -q -E '^[0-9]+$'; then |
| logger -t "${UPSTART_JOB}" \ |
| "ERROR: UNIXTIME_TO_SET is empty or invalid: ${UNIXTIME_TO_SET}" |
| stop |
| exit 1 |
| fi |
| end script |
| |
| script |
| logger -t "${UPSTART_JOB}" "Executing arc-set-time" |
| |
| date --set="@${UNIXTIME_TO_SET}" || \ |
| echo "Failed to execute: date --set=@${UNIXTIME_TO_SET}" |
| end script |