[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: simple cron packaging question



On Thu, Aug 05, 2004 at 08:42:50AM -0700, Josh Lauricha wrote:
> On Thu 08/05/04 17:35, Brian Sutherland wrote:
> > Make sure that if the package is uninstalled, the cron job is
> > disabled?
> 
> I'd do something like:
> # a bunch of lines for setting the command-line options or sourceing
> # /etc/default/<packagename>
> [ -f /usr/lib/<package>/scriptname ] && /usr/lib/<package>/scriptname

Be careful about that in 'set -e' mode or if non-zero exit statuses will
be otherwise reported. I often use one of these idioms instead:

  if [ -f /usr/lib/<package>/scriptname ]; then /usr/lib/<package>/scriptname; fi

  [ ! -f /usr/lib/<package>/scriptname ] || /usr/lib/<package>/scriptname

Cheers,

-- 
Colin Watson                                  [cjwatson@flatline.org.uk]



Reply to: