On 07/25/2011 07:10 PM, Nico Kadel-Garcia wrote:
On Mon, Jul 25, 2011 at 8:46 AM, carlopmart<[email protected]>  wrote:
Hi all,

  I have configured a cron task to start certain virtual machines when kvm
host starts at a certain runlevel (3 or 4). My script:

#!/bin/sh

which_rulevel=`runlevel | awk '{print $2}'`

if [ "$which_rulevel" == 3 ]; then
        sleep 60
        virsh start vmfw01
        sleep 140
        virsh start vmfw02
elif [ "$which_rulevel" == 4 ]; then
        sleep 60
        virsh start vmfw03
fi

  .. And my cron task is located under /etc/cron.d with the following config
file:

SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=""
HOME=/

Hold it. None of this is necessary, and a blank $MAILTO can cause
issues. MAILTO should point to an actual email address, not be set
blank, if you need it. And why are you resetting $SHELL and $PATH?
Yoou should only need those if you use non-standard values.

@reboot * * * * root /root/bin/launch_vms

You have a syntax problem: @reboot, @hourly, etc. replace all the
tiime selection fields in crontab. What you probably want is:

     @reboot     root    /root/bin/launch_vms


Thanks Nico, that was the problem ...


--
CL Martinez
carlopmart {at} gmail {d0t} com

Reply via email to