[Novalug] Re: weekly cron job

DonJr djr1952@hotpop.com
Tue Jan 8 22:09:21 EST 2008


On Tue, 2008-01-08 at 20:37 -0500, Jay Hart wrote:
> Ok, I got this resolved (but not yet resolved) to the component level:
> 
> Don,
> 
> When you wrote this line:
> 
>    /sbin/start-stop-daemon -start --pidfile /dev/null \
>      --startas /usr/bin/sa-learn --oknodo --chuid $WHO \
>      -- --spam -f /tmp/spamfiles
> 
> What was the option supposed to be for the first set of dashes on the third line?

See: man start-stop-daemon
      start-stop-daemon -S|--start options [--] arguments

In other words the finial '-- ' means all following arguments including
those starting with '-' are to be passed to the program (sa-learn in
this case).

The above could be done as (one very long line):

/sbin/start-stop-daemon -start --pidfile /dev/null --startas /usr/bin/sa-learn --oknodo --chuid $WHO -- --spam -f /tmp/spamfiles

but I used the '\' which are suppose to be followed by only a
'line-feed' character to continue the command onto the next line, in
order to hopefully make it more readable.

> Also, I wonder if this line:
> 
> /sbin/start-stop-daemon --start --pidfile /dev/null \
>     --startas /bin/sh \
>     --oknodo --chuid $WHO \
>     -- -c "find ${SPAMDIR} -type f -mtime +15 | xargs rm -f"
> 
> will also have the same problem on the fourth line?

Same thing here, only the program is '/bin/sh' in this case.

> Jay
> 
> >> Jay Hart wrote:
> >>> the script fails at this line:
> >>>
> >>> find ${SPAMDIR} -type f -print > /tmp/spamfiles
> >>>
> >>> with the following error:
> >>>
> >>> email:/etc/cron.weekly # ./spam-learn
> >>> find: /home/jhart/MailDir/.knownspam: No such file or directory
> >>>
> >>> but this directory exists
> >>>
> >>> email:/home/jhart/Maildir # ls -l
> >>> total 372
> >>> <snip other directories>
> >>> drwx------ 6 jhart users  4096 Aug 24 10:24 .knownspam
> >>> <snip other directories>
> >>>
> >>> So, now I know why my script will not run to completion.
> >>>
> >>> What can I do to resolve???
> >>>
> >>> Jay
> >>>
> >> OK, this could be a typo in you mail, but:
> >> MailDir and Maildir are not the same directory.
> >>
> >> Matt
> >>
> >
> > *D*DJDJDDC(D*E&H$OD(D*E&&E(#)#ED&CH... You're right.
> >
> > Ok, that took care of that problem.
> >
> > Next problem:
> >
> > email:/etc/cron.weekly # ./spam-learn
> > /sbin/start-stop-daemon: --signal takes a numeric argument
> > Try `/sbin/start-stop-daemon --help' for more information.
> >
> > Jay

I don't see how either invokation of "/sbin/start-stop-daemon" generated
this message, unless you have trailing SPACES or other junk after a
continue('\') character at the end of a line of text.


--  
-- 
 Don E. Groves, Jr. 

$ /usr/games/fortune : 
In India, "cold weather" is merely a conventional phrase and has come
into use through the necessity of having some way to distinguish between
weather which will melt a brass door-knob and weather which will only
make it mushy.
  -- Mark Twain




More information about the Novalug mailing list