Subject: | |
From: | |
Reply To: | |
Date: | Mon, 25 Jul 2011 13:10:28 -0400 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
On Mon, Jul 25, 2011 at 8:46 AM, carlopmart <[log in to unmask]> 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
> But it doesn't works ... Under cron log I see this message:
>
> Jul 25 14:25:11 srvkvm01 crond[2235]: (CRON) bad command
> (/etc/cron.d/launch_kvms)
>
> I can't see where is the problem. KVM host is a SL6.1 (but with SL6.0
> doesn't works also)...
>
> Any help??
> --
> CL Martinez
> carlopmart {at} gmail {d0t} com
>
|
|
|