cron(8) mis-feature with @reboot long after system startup

Cy Schubert Cy.Schubert at komquats.com
Sat Nov 26 07:09:02 UTC 2011


In message <alpine.BSF.2.00.1111251042110.80691 at wonkity.com>, Warren Block 
writ
es:
>   This message is in MIME format.  The first part should be readable text,
>   while the remaining parts are likely unreadable without MIME-aware tools.
> 
> ---902635197-1839580335-1322243619=:80691
> Content-Type: TEXT/PLAIN; charset=UTF-8; format=flowed
> Content-Transfer-Encoding: 8BIT
> 
> On Fri, 25 Nov 2011, Tom Evans wrote:
> 
> > On Fri, Nov 25, 2011 at 4:09 PM, Cy Schubert <Cy.Schubert at komquats.com> wro
> te:
> >> Changing the behaviour by default would change the semantics of @reboot,
> >> altering  the behaviour of cron jobs which rely on the brokenness. What if
> >> both behaviours are wanted on the same system? Unlikely, as I can't see
> >> anyone relying on this broken behaviour. Having said that, I'm sure there
> >> are cron jobs that do rely on the broken behaviour, so it may be best to
> >> simply deprecate the broken behaviour and make one or the other a command
> >> line option.
> >
> >
> > The problem is that the behaviour is not broken, it works exactly as
> > described in crontab(5) - it is just confusing.
> 
> But crontab(5) just says "startup", when really it means "cron startup", 
> so: http://svnweb.freebsd.org/base?view=revision&revision=227981
> 
> > It's also slightly nonsensical - the command isn't run at reboot, it
> > is run at boot.
> 
> It isn't just at boot, even.  Really it should be called @cronstart.
> But that ship probably sailed a long time ago.  A better alias could be 
> added and @reboot marked as deprecated.  (This does not address the 
> technical problem of really only running something at system startup. 
> IMHO, rc scripts are a better fit for that.)

Agreed, that's what rc scripts are for.

OTOH, a non-root user can't create rc scripts. Having said that, any 
non-root rc scripts I've ever run always required negotiation, e.g. oracle 
and other apps. You want to start other apps in a specified order.

When running non-root rc scripts, it's a simple matter of,

/bin/su - oracle -c '/home/oracle/product/oracle-8i/bin/startup.sh'

If average users really do need to run something at boot they're likely 
running some kind of service, e.g. some kind of DBMS, on the machine and 
that would usually if not always require some kind of cooperation with the 
sysadmin.


-- 
Cheers,
Cy Schubert <Cy.Schubert at komquats.com>
FreeBSD UNIX:  <cy at FreeBSD.org>   Web:  http://www.FreeBSD.org




More information about the freebsd-hackers mailing list