Package: cron
Version: 3.0pl1-133
Severity: minor

Dear Maintainer,
I tried the following command line in the crontab:
        * * * * * [ "$(date +%d)" -gt 10 ] && date >> /tmp/test.log
but when the condition occurred, no log file was generated.

I observed that the journal reported:
        mar 15 11:05:01 UFFICIO CRON[29344]: (root) CMD ([29346] [ "$(date
+)
        mar 15 11:05:01 UFFICIO CRON[29344]: (CRON) error (grandchild
#29346 failed with exit status 2)
so the problem was the percentage character that interrupted the command
and also generated an error

If I insert a backslash before:
        * * * * * [ "$(date +\%d)" -gt 10 ] && date >> /tmp/test.log

it works well:
        mar 15 11:08:01 UFFICIO CRON[30832]: (root) CMD ([30834] [
"$(date+%d)" -gt 10 ] && date >> /tmp/test.log)

Question: the percentage must be considered special character (I can't find
this in the documentation) or is it only a cron problem?

Thank you,
Antonio


-- Package-specific info:
--- EDITOR:
--- /usr/bin/editor: /usr/bin/ne
--- /usr/bin/crontab: -rwxr-sr-x 1 root crontab 43568 Mar 12 07:34
/usr/bin/crontab
--- /var/spool/cron: drwxr-xr-x 5 root root 4096 Mar 12 07:34
/var/spool/cron
--- /var/spool/cron/crontabs: drwx-wx--T 2 root crontab 4096 Mar 15 11:18
/var/spool/cron/crontabs
--- /etc/cron.d: drwxr-xr-x 2 root root 4096 Mar 12 14:50 /etc/cron.d
--- /etc/cron.daily: drwxr-xr-x 2 root root 4096 Mar 12 14:50
/etc/cron.daily
--- /etc/cron.hourly: drwxr-xr-x 2 root root 4096 Mar 12 07:34
/etc/cron.hourly
--- /etc/cron.monthly: drwxr-xr-x 2 root root 4096 Mar 12 07:34
/etc/cron.monthly
--- /etc/cron.weekly: drwxr-xr-x 2 root root 4096 Mar 12 07:34
/etc/cron.weekly

-- System Information:
Debian Release: buster/sid
  APT prefers unstable
  APT policy: (700, 'unstable'), (600, 'testing'), (500, 'stable-updates'),
(500, 'stable'), (100, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.0.2-custom (SMP w/8 CPU cores; PREEMPT)
Locale: LANG=it_IT, LC_CTYPE=it_IT (charmap=ISO-8859-1) (ignored: LC_ALL
set to it_IT), LANGUAGE=it (charmap=ISO-8859-1) (ignored: LC_ALL set to
it_IT)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages cron depends on:
ii  adduser              3.118
ii  debianutils          4.8.6.1
ii  init-system-helpers  1.56+nmu1
ii  libc6                2.28-8
ii  libpam-runtime       1.3.1-5
ii  libpam0g             1.3.1-5
ii  libselinux1          2.8-1+b1
ii  lsb-base             10.2019031300
ii  sensible-utils       0.0.12

Versions of packages cron recommends:
ii  postfix [mail-transport-agent]  3.4.1-1

Versions of packages cron suggests:
ii  anacron        2.3-27
ii  checksecurity  2.0.16+nmu1
ii  logrotate      3.14.0-4

Versions of packages cron is related to:
pn  libnss-ldap   <none>
pn  libnss-ldapd  <none>
pn  libpam-ldap   <none>
pn  libpam-mount  <none>
pn  nis           <none>
pn  nscd          <none>

-- no debconf information

Reply via email to