mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-07-14 15:43:35 +00:00

- move action() from common to sysvinit wrapper since its only really applicable for sysvinit and not the other init systems - fix bug in action() fallback, need to shift away msg before executing action - make lxc-net 98 so it starts before lxc-container (99), otherwise the lxcbr0 won't be available when containers are autostarted - make the default RUNTIME_PATH be /var/run instead of /run. On older distros (like ol6.5) /run doesn't exist. lxc-net will create this directory and attempt to create the dnsmasq.pid file in it, but this will fail when SELinux is enabled because the directory will have the default_t type. Newer systems have /var/run symlinked to /run so you get to the same place in that case. - add %postun to remove lxc-dnsmasq user when pkgs are removed - fix bug in lxc-oracle template that was creating /var/lock/subsys/lxc as a dir and interfering with the init scripts Signed-off-by: Dwight Engen <dwight.engen@oracle.com> Acked-by: Stéphane Graber <stgraber@ubuntu.com>
62 lines
1.2 KiB
Bash
62 lines
1.2 KiB
Bash
#!/bin/sh
|
|
#
|
|
# lxc Start/Stop LXC autoboot containers
|
|
#
|
|
# chkconfig: 345 99 01
|
|
# description: Starts/Stops all LXC containers configured for autostart.
|
|
#
|
|
### BEGIN INIT INFO
|
|
# Provides: lxc
|
|
# Default-Start: 2 3 4 5
|
|
# Default-Stop: 0 1 6
|
|
# Short-Description: Bring up/down LXC autostart containers
|
|
# Description: Bring up/down LXC autostart containers
|
|
### END INIT INFO
|
|
|
|
sysconfdir="@SYSCONFDIR@"
|
|
|
|
# Source function library.
|
|
test ! -r "$sysconfdir"/rc.d/init.d/functions ||
|
|
. "$sysconfdir"/rc.d/init.d/functions
|
|
|
|
# provide action() fallback
|
|
if ! type action >/dev/null 2>&1; then
|
|
# Real basic fallback for sysvinit "action" verbage.
|
|
action() {
|
|
echo -n "$1 "
|
|
shift
|
|
"$@" && echo "OK" || echo "Failed"
|
|
}
|
|
fi
|
|
|
|
start() {
|
|
action $"Starting LXC autoboot containers: " @LIBEXECDIR@/lxc/lxc-containers start
|
|
}
|
|
|
|
stop() {
|
|
action $"Stopping LXC containers: " @LIBEXECDIR@/lxc/lxc-containers stop
|
|
}
|
|
|
|
# See how we were called.
|
|
case "$1" in
|
|
start)
|
|
start
|
|
;;
|
|
|
|
stop)
|
|
stop
|
|
;;
|
|
|
|
restart|reload|force-reload)
|
|
$0 stop
|
|
$0 start
|
|
;;
|
|
|
|
*)
|
|
echo "Usage: $0 {start|stop|restart|reload|force-reload}"
|
|
exit 2
|
|
;;
|
|
esac
|
|
|
|
exit $?
|