NetBSD-Bugs archive

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

Re: bin/58408: cron ignores parameter "-n" in crontab



I just tried your example and it worked as expected

log_it: (christos 5384) CMD START (/u/christos/cron1)
log_it: (christos 15992) CMD START (/u/christos/cron2)
[4179] child continues, closing pipes
[4179] child reading output from grandchild
[13945] child continues, closing pipes
[13945] child reading output from grandchild
[7886] child continues, closing pipes
[7886] child reading output from grandchild
[4179] got EOF from grandchild [0]
log_it: (christos 4179) CMD FINISH (/usr/bin/true)
[4179] child process done (rc=0), exiting
[20135] sigchld...pid #4179 died, stat=0
[20135] sigchld...no dead kids
[7886] got data (77:w) from grandchild
[7886] aborting pipe to mail
[13945] got data (77:w) from grandchild
[13945] closing pipe to mail
[13945] got EOF from grandchild [0]
log_it: (christos 13945) CMD FINISH (/u/christos/cron2)
[13945] child process done (rc=0), exiting
[20135] sigchld...pid #13945 died, stat=0
[20135] sigchld...no dead kids

you can try running cron -x proc


christos

> On Jul 9, 2024, at 3:35 AM, nmingotti%gmail.com@localhost wrote:
> 
>> Number:         58408
>> Category:       bin
>> Synopsis:       cron ignores parameter "-n" in crontab
>> Confidential:   no
>> Severity:       non-critical
>> Priority:       medium
>> Responsible:    bin-bug-people
>> State:          open
>> Class:          sw-bug
>> Submitter-Id:   net
>> Arrival-Date:   Tue Jul 09 07:35:00 +0000 2024
>> Originator:     Dr. Nicola Mingotti
>> Release:        10.0
>> Organization:
> Borghi SRL
>> Environment:
> NetBSD pulce4 10.0 NetBSD 10.0 (GENERIC) #0: Thu Mar 28 08:33:33 UTC 2024  mkrepro%mkrepro.NetBSD.org@localhost:/usr/src/sys/arch/evbarm/compile/GENERIC evbarm
> 
>> Description:
> According to man page crontab (5), if the modifier '-n' is used before a command no mail should be sent on successful run. This is not the case, parameter '-n' is ignored. Example below. 
> 
> 
> 
> 
>> How-To-Repeat:
> 
> ---- /home/p/bin/test3.sh ----------
> #!/bin/sh
> echo "test3.sh -- `date` " >> /home/p/bin/test.log
> echo "write something and quit. "
> exit 0
> ------------------------------------
> 
> ---- /home/p/bin/test4.sh ----------
> #!/bin/sh
> echo "test4.sh -- `date` " >> /home/p/bin/test.log
> echo "write something and fail"
> exit 1
> ------------------------------------
> 
> p@pulce4 $> crontab -l 
> -----------
> #
> #minute hour    mday    month   wday    command
> */1     *       *       *       *        -n /home/p/bin/test3.sh
> */1     *       *       *       *        -n /home/p/bin/test4.sh
> -----------
> 
> . wait a bit
> p@pulce4> mail 
> ----
> N 14 root@pulce4.localdom  Tue Jul  9 08:55   3/695   "Cron <p@pulce4> /home/p/bin/test3.sh"
> N 15 root@pulce4.localdom  Tue Jul  9 08:56   3/693   "Cron <p@pulce4> /home/p/bin/test4.sh"
> N 16 root@pulce4.localdom  Tue Jul  9 08:56   3/695   "Cron <p@pulce4> /home/p/bin/test3.sh"
> N 17 root@pulce4.localdom  Tue Jul  9 08:57   3/693   "Cron <p@pulce4> /home/p/bin/test4.sh"
> N 18 root@pulce4.localdom  Tue Jul  9 08:57   3/695   "Cron <p@pulce4> /home/p/bin/test3.sh"
> N 19 root@pulce4.localdom  Tue Jul  9 08:58   3/693   "Cron <p@pulce4> /home/p/bin/test4.sh"
> N 20 root@pulce4.localdom  Tue Jul  9 08:58   3/695   "Cron <p@pulce4> /home/p/bin/test3.sh"
> N 21 root@pulce4.localdom  Tue Jul  9 08:59   3/693   "Cron <p@pulce4> /home/p/bin/test4.sh"
> N 22 root@pulce4.localdom  Tue Jul  9 08:59   3/695   "Cron <p@pulce4> /home/p/bin/test3.sh"
> ----
> 
> 
> 
> 
> 
> 
>> Fix:
> 



Home | Main Index | Thread Index | Old Index