From a8ad77bda7a6837800b40d10bd04543c327c2cc1 Mon Sep 17 00:00:00 2001 From: Eric Gable Date: Tue, 20 Aug 2013 15:52:39 -0700 Subject: [PATCH] Adding distro and config directories for setup.py --- config/waagent.conf | 57 +++++++++++++++++ config/waagent.logrotate | 7 +++ distro/redhat/waagent.sysV | 54 ++++++++++++++++ distro/suse/waagent.sysV | 110 +++++++++++++++++++++++++++++++++ distro/systemd/waagent.service | 13 ++++ 5 files changed, 241 insertions(+) create mode 100644 config/waagent.conf create mode 100644 config/waagent.logrotate create mode 100644 distro/redhat/waagent.sysV create mode 100644 distro/suse/waagent.sysV create mode 100644 distro/systemd/waagent.service diff --git a/config/waagent.conf b/config/waagent.conf new file mode 100644 index 0000000000..86f42fdc57 --- /dev/null +++ b/config/waagent.conf @@ -0,0 +1,57 @@ +# +# Windows Azure Linux Agent Configuration +# + +# Specified program is invoked with "Ready" or "Shutdown". +# Shutdown will be initiated only after the program returns. Windows Azure will +# power off the VM if shutdown is not completed within ?? minutes. +Role.StateConsumer=None + +# Specified program is invoked with XML file argument specifying role +# configuration. +Role.ConfigurationConsumer=None + +# Specified program is invoked with XML file argument specifying role topology. +Role.TopologyConsumer=None + +# Enable instance creation +Provisioning.Enabled=y + +# Password authentication for root account will be unavailable. +Provisioning.DeleteRootPassword=y + +# Generate fresh host key pair. +Provisioning.RegenerateSshHostKeyPair=y + +# Supported values are "rsa", "dsa" and "ecdsa". +Provisioning.SshHostKeyPairType=rsa + +# Monitor host name changes and publish changes via DHCP requests. +Provisioning.MonitorHostName=y + +# Format if unformatted. If 'n', resource disk will not be mounted. +ResourceDisk.Format=y + +# File system on the resource disk +ResourceDisk.Filesystem=ext4 + +# ount point for the resource disk +ResourceDisk.MountPoint=/mnt/resource + +# Create and use swapfile on resource disk. +ResourceDisk.EnableSwap=n + +# Size of the swapfile. +ResourceDisk.SwapSizeMB=0 + +# Respond to load balancer probes if requested by Windows Azure. +LBProbeResponder=y + +# Logging level +Logs.Verbose=n + +# Root device timeout in seconds. +OS.RootDeviceScsiTimeout=300 + +# If "None", the system default version is used. +OS.OpensslPath=None diff --git a/config/waagent.logrotate b/config/waagent.logrotate new file mode 100644 index 0000000000..7ce0522f63 --- /dev/null +++ b/config/waagent.logrotate @@ -0,0 +1,7 @@ +/var/log/waagent.log { + compress + monthly + rotate 6 + notifempty + missingok +} diff --git a/distro/redhat/waagent.sysV b/distro/redhat/waagent.sysV new file mode 100644 index 0000000000..d1278e714e --- /dev/null +++ b/distro/redhat/waagent.sysV @@ -0,0 +1,54 @@ +#!/bin/bash +# +# Init file for WindowsAzureLinuxAgent. +# +# chkconfig: 2345 60 80 +# description: WindowsAzureLinuxAgent +# + +# source function library +. /etc/rc.d/init.d/functions + +RETVAL=0 +FriendlyName="WindowsAzureLinuxAgent" +WAZD_BIN=/usr/sbin/waagent + +start() +{ + echo -n $"Starting $FriendlyName: " + $WAZD_BIN -daemon & +} + +stop() +{ + echo -n $"Stopping $FriendlyName: " + killproc -p /var/run/waagent.pid $WAZD_BIN + RETVAL=$? + echo + return $RETVAL +} + +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart) + stop + start + ;; + reload) + ;; + report) + ;; + status) + status $WAZD_BIN + RETVAL=$? + ;; + *) + echo $"Usage: $0 {start|stop|restart|status}" + RETVAL=1 +esac +exit $RETVAL diff --git a/distro/suse/waagent.sysV b/distro/suse/waagent.sysV new file mode 100644 index 0000000000..eac3750872 --- /dev/null +++ b/distro/suse/waagent.sysV @@ -0,0 +1,110 @@ +#! /bin/sh +# +# Windows Azure Linux Agent sysV init script +# +# Copyright 2013 Microsoft Corporation +# Copyright SUSE LLC +# +# 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. +# +# /etc/init.d/waagent +# +# and symbolic link +# +# /usr/sbin/rcwaagent +# +# System startup script for the waagent +# +### BEGIN INIT INFO +# Provides: WindowsAzureLinuxAgent +# Required-Start: $network sshd +# Required-Stop: $network sshd +# Default-Start: 3 5 +# Default-Stop: 0 1 2 6 +# Description: Start the WindowsAzureLinuxAgent +### END INIT INFO + +WAZD_BIN=/usr/sbin/waagent +test -x $WAZD_BIN || { echo "$WAZD_BIN not installed"; exit 5 } +WAZD_CONF=/etc/waagent.conf +test -e $WAZD_CONF || { echo "$WAZD_CONF not found"; exit 5 } + +. /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 "Starting WindowsAzureLinuxAgent" + ## Start daemon with startproc(8). If this fails + ## the echo return value is set appropriate. + + startproc -f $WAZD_BIN -daemon + rc_status -v + ;; + stop) + echo "Shutting down WindowsAzureLinuxAgent" + ## Stop daemon with killproc(8) and if this fails + ## set echo the echo return value. + + killproc -p /var/run/waagent.pid $WAZD_BIN + rc_status -v + ;; + try-restart) + ## Stop the service and if this succeeds (i.e. the + ## service was running before), start it again. + $0 status >/dev/null && $0 restart + rc_status + ;; + restart) + ## Stop the service and regardless of whether it was + ## running or not, start it again. + $0 stop + sleep 1 + $0 start + rc_status + ;; + force-reload|reload) + rc_status + ;; + status) + echo -n "Checking for service WindowsAzureLinuxAgent " + ## Check status with checkproc(8), if process is running + ## checkproc will return with exit status 0. + + checkproc -p $WAZD_PIDFILE $WAZD_BIN + rc_status + ;; + probe) + ;; + *) + echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload}" + exit 1 + ;; +esac +rc_exit diff --git a/distro/systemd/waagent.service b/distro/systemd/waagent.service new file mode 100644 index 0000000000..a61fc9df8f --- /dev/null +++ b/distro/systemd/waagent.service @@ -0,0 +1,13 @@ +[Unit] +Description=Windows Azure Linux Agent +After=network.target +After=sshd.service +ConditionFileIsExecutable=/usr/sbin/waagent +ConditionPathExists=/etc/waagent.conf + +[Service] +Type=simple +ExecStart=/usr/sbin/waagent -daemon + +[Install] +WantedBy=multi-user.target