File google-clock-skew-daemon.suse of Package google-compute-engine.5968
#!/bin/sh
# Copyright 2016 Google Inc. All Rights Reserved.
# Copyright 2016 SUSE LLC All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
### BEGIN INIT INFO
# Provides: google_clock_skew_daemon
# Required-Start: $network $syslog $google_instance_setup $remote_fs
# Required-Stop: $network
# Default-Start: 2 3 5
# Default-Stop: 0 1 6
# Short-Description: Google Compute Engine Clock Skew Daemon
# Description: Sync the system clock on migration.
### END INIT INFO
# Do NOT "set -e".
NAME=google-clock-skew-daemon
DAEMON=/usr/bin/google_clock_skew_daemon
# Exit if the package is not installed.
[ -x "$DAEMON" ] || exit 0
# Shell functions sourced from /etc/rc.status:
# rc_check check and set local and overall rc status
# rc_status check and set local and overall rc status
# rc_status -v ditto but be verbose in local rc status
# rc_status -v -r ditto and clear the local rc status
# rc_failed set local and overall rc status to failed
# rc_reset clear local rc status (overall remains)
# rc_exit exit appropriate to overall rc status
. /etc/rc.status
# First reset status of this service
rc_reset
# Return values acc. to LSB for all commands but status:
# 0 - success
# 1 - misc error
# 2 - invalid or excess args
# 3 - unimplemented feature (e.g. reload)
# 4 - insufficient privilege
# 5 - program not installed
# 6 - program not configured
#
# Note that starting an already running service, stopping
# or restarting a not-running service as well as the restart
# with force-reload (in case signalling is not supported) are
# considered a success.
case "$1" in
start)
echo -n "Starting $NAME daemon "
## Start daemon with startproc(8). If this fails
## the echo return value is set appropriate.
# startproc should return 0, even if service is
# already running to match LSB spec.
startproc $DAEMON
# Remember status and be verbose
rc_status -v
;;
stop)
echo -n "Shutting down $NAME daemon "
killproc -TERM $DAEMON
# Remember status and be verbose
rc_status -v
;;
status)
echo -n "Checking for $NAME daemon "
## Check status with checkproc(8), if process is running
## checkproc will return with exit status 0.
# Status has a slightly different for the status command:
# 0 - service running
# 1 - service dead, but /var/run/ pid file exists
# 2 - service dead, but /var/lock/ lock file exists
# 3 - service not running
# NOTE: checkproc returns LSB compliant status values.
checkproc $DAEMON
rc_status -v
;;
restart|force-reload)
$0 stop
$0 start
;;
*)
echo $"Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}"
exit 1
;;
esac