Re: [systemd-devel] /etc/rc.d/ on shutdown incompatible

2011-08-02 Thread Reindl Harald


Am 02.08.2011 00:57, schrieb Lennart Poettering:
 On Fri, 22.07.11 10:39, Reindl Harald (h.rei...@thelounge.net) wrote:
 
 i think systemd does not wait until this script has finsished
 what can take some minutes if you have and hand full of virtual
 machines running with hughe memory
 
 We wait for all operations, but we time them out. SysV start/stop
 scripts are timed out after 5min which should be plenty time even for
 the slowest scripts. You can freely increase (or even disable that) in
 unit files.

but even if the suspend of vm's would only take
a view seconds - since F15 they are killed hard on shutdown

 independent from a needed fix somewhere in systemd:
 what is the best way to place any shell script which is
 called at the first place before reboot/shutdown and
 how force systemd to wait with all other shutdwon-actions
 until this is finished?
 
 first place before boot? What's that? in initrd?

REBOOT / SHUTDOWN not boot

i wan tmy own shell-script that do all my jobs and force systemd
to wait until this is really finished before the system goes down
and i need to have it as sonn as possible to act before other
services are stopped






signature.asc
Description: OpenPGP digital signature
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] /etc/rc.d/ on shutdown incompatible

2011-08-01 Thread Lennart Poettering
On Fri, 22.07.11 10:39, Reindl Harald (h.rei...@thelounge.net) wrote:

 i think systemd does not wait until this script has finsished
 what can take some minutes if you have and hand full of virtual
 machines running with hughe memory

We wait for all operations, but we time them out. SysV start/stop
scripts are timed out after 5min which should be plenty time even for
the slowest scripts. You can freely increase (or even disable that) in
unit files.

 independent from a needed fix somewhere in systemd:
 what is the best way to place any shell script which is
 called at the first place before reboot/shutdown and
 how force systemd to wait with all other shutdwon-actions
 until this is finished?

first place before boot? What's that? in initrd?

If you want an executable started during boot, the easiest way is to
stick it some place (for example /usr/local/bin), and then place a unit
file like this in /etc/systemd/system/yourservice.service:

[Service]
ExecStart=/usr/local/bin/myservice

and then symlink this file to
/etc/systemd/system/multi-user.target.wants/yourservice.service to start
at boot.

Lennart

-- 
Lennart Poettering - Red Hat, Inc.
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] /etc/rc.d/ on shutdown incompatible

2011-07-22 Thread Reindl Harald
Hi

using VMware-Workstation on a machine with systemd (Fedora 15)
and have running virtual machines during shutdown or reboot
ends in killing their processes instead waiting for vmware-suspend

attached the /etc/init.d/vmware-script

from line 353 the original looks if the script is called
with a K at the begin and only then running machines will
be suspended, manually stop the service would give you a
message that this is nit possible

so first i thought remove this K thing from the script
and it would work - well now i can say service vmware stop
in every state and they will be suspended

BUT on reboot/shutdown this does not happen
___

i think systemd does not wait until this script has finsished
what can take some minutes if you have and hand full of virtual
machines running with hughe memory

independent from a needed fix somewhere in systemd:
what is the best way to place any shell script which is
called at the first place before reboot/shutdown and
how force systemd to wait with all other shutdwon-actions
until this is finished?
#!/usr/bin/env bash
#
# Copyright 1998-2008 VMware, Inc.  All rights reserved.
#
# This script manages the services needed to run VMware software.
#

# Basic support for IRIX style chkconfig
###
# chkconfig: 235 19 08
# description: Manages the services needed to run VMware software
###

# Basic support for the Linux Standard Base Specification 1.3
# Used by insserv and other LSB compliant tools.
### BEGIN INIT INFO
# Provides: VMware
# Required-Start: $network $syslog
# Required-Stop:
# Default-Start: 2 3 5
# Default-Stop: 0 6
# Short-Description: Manages the services needed to run VMware software
# Description: Manages the services needed to run VMware software
### END INIT INFO

ETCDIR=/etc/vmware
VMIS_MAJOR_VERSION=1

. $ETCDIR/bootstrap
libdir=$LIBDIR/vmware

. $libdir/scripts/util.sh

load_settings $libdir || exit 1

VNETLIB_LOG=/var/log/vnetlib
PRODUCT_NAME=VMware Player
COMPONENT_NAME=vmware-player-app

# This comment is a hack to prevent RedHat distributions from outputing
# Starting basename of this script when running this startup script.
# We just need to write the word daemon followed by a space

# This defines echo_success() and echo_failure() on RedHat
if [ -r $INITSCRIPTDIR'/functions' ]; then
   . $INITSCRIPTDIR'/functions'
fi

# This defines $rc_done and $rc_failed on S.u.S.E.
if [ -f /etc/rc.config ]; then
   # Don't include the entire file: there could be conflicts
   rc_done=`(. /etc/rc.config; echo $rc_done)`
   rc_failed=`(. /etc/rc.config; echo $rc_failed)`
else
   # Make sure the ESC byte is literal: Ash does not support echo -e
   rc_done=' done'
   rc_failed='failed'
fi

subsys=vmware
driver=vmmon
vnet=vmnet
vmblock=vmblock
vmci=vmci
vsock=vsock

vmciNode=vmci
vsockNode=vsock

# SHM settings
shmmaxPath=/proc/sys/kernel/shmmax
shmmaxMinValue=268435456 # 256MB

#
# Are we running in a VM?
#
vmwareInVM() {
   $BINDIR/checkvm /dev/null 21
}

#
# Report a positive number if there are any VMs running.
# May not be the actual vmmon reference count.
#
vmmonUseCount() {
   local count
   # Beware of module dependencies here. An exact match is important
   count=`/sbin/lsmod | awk 'BEGIN {n = 0} {if ($1 == '$driver') n = $3} 
END {print n}'`
   # If CONFIG_MODULE_UNLOAD is not set in the kernel, lsmod prints '-' instead 
of the
   # reference count, so ask vmrun, or if we don't have vmrun, look for running 
vmx processes
   if [ x${count} = x- ]
   then
  type vmrun  /dev/null 21
  if [ $? -eq 0 ]
  then
 count=`vmrun list | awk 'BEGIN {n=0} /^Total running VMs:/ {n = $4} 
END {print n}'`
  else
 count=`ps -afe | grep /bin/vmware-vmx | grep -v grep | wc -l`
  fi
   fi
   echo $count
}

# Is a given module loaded?
isLoaded() {
   local module=$1

   /sbin/lsmod | awk 'BEGIN {n = no;} {if ($1 == '$module') n = yes;} 
END {print n;}'
}

# Build a Linux kernel integer version
kernelVersionInteger() {
   echo $$1 * 256) + $2) * 256 + $3))
}

# Get the running kernel integer version
getVersionInteger() {
   local version_uts
   local v1
   local v2
   local v3

   version_uts=`uname -r`

   # There is no double quote around the back-quoted expression on purpose
   # There is no double quote around $version_uts on purpose
   set -- `IFS='.'; echo $version_uts`
   v1=$1
   v2=$2
   v3=$3
   # There is no double quote around the back-quoted expression on purpose
   # There is no double quote around $v3 on purpose
   set -- `IFS='-ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz'; echo 
$v3`
   v3=$1

   kernelVersionInteger $v1 $v2 $v3
}

vmwareLoadModule() {
   /sbin/insmod -s -f /lib/modules/`uname -r`/misc/$1.ko || exit 1
   return 0
}

vmwareUnloadModule() {
   if [ `isLoaded $1` = 'yes' ]; then
  /sbin/rmmod $1 || exit 1
   fi
   return 0
}

# Start the virtual machine monitor kernel service
vmwareStartVmmon() {
   vmwareLoadModule $driver
}

# Stop the virtual machine monitor