FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > CentOS > CentOS

 
 
LinkBack Thread Tools
 
Old 12-14-2009, 06:46 AM
Roland Roland
 
Default Cron job? or something else? help..

Hello,

i have a certain issue at hand that i'm trying to solve.

there's a certain command that i need to execute 10 minutes after boot.
how can i set that? im not very expert with cron jobs but can it be done
that way? i know that cronjob works on specified time but how can i set
it to run with '10 min after startup" as a condition ?



_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 12-14-2009, 06:51 AM
Michel van Deventer
 
Default Cron job? or something else? help..

Hi,

On Mon, 2009-12-14 at 09:46 +0200, Roland Roland wrote:
> Hello,
>
> i have a certain issue at hand that i'm trying to solve.
>
> there's a certain command that i need to execute 10 minutes after boot.
> how can i set that? im not very expert with cron jobs but can it be done
> that way? i know that cronjob works on specified time but how can i set
> it to run with '10 min after startup" as a condition ?
There's no such option in cron. But the easiest way to do this is to put
it in /etc/rc.d/rc.local like this :

sleep 600 && <command>

this waits 600 seconds and (if succesfully) executes your command

Regards,

Michel


_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 12-14-2009, 06:55 AM
John R Pierce
 
Default Cron job? or something else? help..

Roland Roland wrote:
> Hello,
>
> i have a certain issue at hand that i'm trying to solve.
>
> there's a certain command that i need to execute 10 minutes after boot.
> how can i set that? im not very expert with cron jobs but can it be done
> that way? i know that cronjob works on specified time but how can i set
> it to run with '10 min after startup" as a condition ?
>

put a script in rc.local thats run with a 'detach', eg, a trailing &,
and in this script, have something like...

sleep 10m
/path/to/rest-of-your-commands


_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 12-14-2009, 06:56 AM
Eero Volotinen
 
Default Cron job? or something else? help..

Quoting Roland Roland <R_O_L_A_N_D@hotmail.com>:

> Hello,
>
> i have a certain issue at hand that i'm trying to solve.
>
> there's a certain command that i need to execute 10 minutes after boot.
> how can i set that? im not very expert with cron jobs but can it be done
> that way? i know that cronjob works on specified time but how can i set
> it to run with '10 min after startup" as a condition ?
>
>
>
> _______________________________________________
> CentOS mailing list
> CentOS@centos.org
> http://lists.centos.org/mailman/listinfo/centos
>

maybe cron "time" @reboot helps with combined to at now + time command ?

--
Eero



--
Eero

_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 12-14-2009, 07:05 AM
Michel van Deventer
 
Default Cron job? or something else? help..

Hi,

On Mon, 2009-12-14 at 08:51 +0100, Michel van Deventer wrote:
> Hi,
>
> On Mon, 2009-12-14 at 09:46 +0200, Roland Roland wrote:
> > Hello,
> >
> > i have a certain issue at hand that i'm trying to solve.
> >
> > there's a certain command that i need to execute 10 minutes after boot.
> > how can i set that? im not very expert with cron jobs but can it be done
> > that way? i know that cronjob works on specified time but how can i set
> > it to run with '10 min after startup" as a condition ?
> There's no such option in cron. But the easiest way to do this is to put
> it in /etc/rc.d/rc.local like this :
>
> sleep 600 && <command>
>
> this waits 600 seconds and (if succesfully) executes your command
And (of course) slows down bootup Better put the sleep 600 in your script and start the script detached from /etc/rc.d/rc.local (with an & )

Regards,

Michel


_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 12-14-2009, 03:52 PM
Benjamin Franz
 
Default Cron job? or something else? help..

Roland Roland wrote:
> Hello,
>
> i have a certain issue at hand that i'm trying to solve.
>
> there's a certain command that i need to execute 10 minutes after boot.
> how can i set that? im not very expert with cron jobs but can it be done
> that way? i know that cronjob works on specified time but how can i set
> it to run with '10 min after startup" as a condition ?
>
>

In /etc/rc.d/rc.local add a line like this:

/usr/bin/at 'now + 10 min' -f /path/to/command

--
Benjamin Franz

_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 12-14-2009, 04:39 PM
Brian Mathis
 
Default Cron job? or something else? help..

On Mon, Dec 14, 2009 at 2:46 AM, Roland Roland <R_O_L_A_N_D@hotmail.com> wrote:
> Hello,
>
> i have a certain issue at hand that i'm trying to solve.
>
> there's a certain command that i need to execute 10 minutes after boot.
> how can i set that? im not very expert with cron jobs but can it be done
> that way? i know that cronjob works on specified time but how can i set
> it to run with '10 min after startup" as a condition ?

Only you know your specific requirements, but this seems like an odd
thing to need. Do you need to wait 10 minutes to make sure some
service is running before starting something else? What creates the
need for a 10 minute delay? Maybe there's a better way to handle it.
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 12-14-2009, 04:43 PM
Ray Van Dolson
 
Default Cron job? or something else? help..

On Mon, Dec 14, 2009 at 12:39:50PM -0500, Brian Mathis wrote:
> On Mon, Dec 14, 2009 at 2:46 AM, Roland Roland <R_O_L_A_N_D@hotmail.com> wrote:
> > Hello,
> >
> > i have a certain issue at hand that i'm trying to solve.
> >
> > there's a certain command that i need to execute 10 minutes after boot.
> > how can i set that? im not very expert with cron jobs but can it be done
> > that way? i know that cronjob works on specified time but how can i set
> > it to run with '10 min after startup" as a condition ?
>
> Only you know your specific requirements, but this seems like an odd
> thing to need. Do you need to wait 10 minutes to make sure some
> service is running before starting something else? What creates the
> need for a 10 minute delay? Maybe there's a better way to handle it.

You could configure a service that starts automatically in run level 3
(or 5) whose start() argument forks off (backgrounds) the process you
want to run, prepended by a "sleep 600" statement.

This way the service won't hold up everything else, but your command
won't run until 600 seconds have elapsed.

You could write the sysv init script to have service <servicename> stop
abort, etc...

Ray
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 

Thread Tools




All times are GMT. The time now is 06:59 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org