cron does not read $PATH

Bug #1534377 reported by Humphrey van Polanen Petel
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cron (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games

Gnome _schedule command preview=/usr/local/bin/bup && tail -f /var/mail/humphrey >~/Desktop/bup-log

/usr/local/bin contains bin

log contains
--
Content-Type: text/plain; charset=ANSI_X3.4-1968
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <HOME=/home/humphrey>
X-Cron-Env: <PATH=/usr/bin:/bin>
X-Cron-Env: <LOGNAME=humphrey>
Message-Id: <20160110054001.2130AF227EB@David>
Date: Sun, 10 Jan 2016 16:40:01 +1100 (AEDT)

/bin/sh: 1: bup: not found
--

cron does not read PATH

ProblemType: Bug
DistroRelease: Ubuntu 14.04
Package: cron 3.0pl1-124ubuntu2
ProcVersionSignature: Ubuntu 3.16.0-57.77~14.04.1-generic 3.16.7-ckt20
Uname: Linux 3.16.0-57-generic x86_64
ApportVersion: 2.14.1-0ubuntu3.19
Architecture: amd64
CurrentDesktop: Unity
Date: Fri Jan 15 10:39:57 2016
InstallationDate: Installed on 2015-09-08 (128 days ago)
InstallationMedia: Ubuntu 14.04.2 LTS "Trusty Tahr" - Release amd64 (20150218.1)
SourcePackage: cron
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Humphrey van Polanen Petel (hpvpp) wrote :
Revision history for this message
Humphrey van Polanen Petel (hpvpp) wrote :

If cron doesn't read $PATH then the only things cron recognizes is inbuilt commands.

Okay, I (now) know how to work around it, but I think it is *seriously* bad publicity for linux systems.

Revision history for this message
Christian Kastner (ckk) wrote : Re: [Bug 1534377] [NEW] cron does not read $PATH

On 2016-01-15 00:47, Humphrey van Polanen Petel wrote:
> PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
>
> Gnome _schedule command preview=/usr/local/bin/bup
  ^^^^^^^^^^
That's not a cron command, that is some independent Gnome frontend. cron
only reads crontabs from /var/spool/cron/crontabs.

You create and edit crontabs by executing "crontab -e". For information
on how to set PATH for cron jobs, please see crontab(5). Anything else
you'll have to report against Gnome.

Regards,
Christian

Changed in cron (Ubuntu):
status: New → Invalid
Revision history for this message
Humphrey van Polanen Petel (hpvpp) wrote :

Dear Christian,

Just so you know, it *is* a cron command.
Gnome Schedule is nothing but a pretty gui to crontab.
I suggest you be a bit more charitable when reading bug reports.

After some study of the documentation, I have come to the conclusion that cron/crontab is very much in need of a revamp. Certainly, it does the job, but then that depends on how the job-requirements are defined. To be sure, it is probably very difficult and much more complex than I can imagine, but being used to the Windows Task Scheduler I suggest that it could be a lot more user-friendly.

Revision history for this message
Christian Kastner (ckk) wrote : Re: [Bug 1534377] Re: cron does not read $PATH

On 2016-01-19 04:01, Humphrey van Polanen Petel wrote:
> Just so you know, it *is* a cron command.
> Gnome Schedule is nothing but a pretty gui to crontab.

And that pretty GUI is from an entirely separate package than package
cron, against which you reported the bug.

> I suggest you be a bit more charitable when reading bug reports.

Please follow your own suggestion. I already explained how cron works:
via crontabs, ie plaintext files in a specific directory. If a client
program (be it from Gnome, KDE, or whatever) uses this interface
incorrectly, then it is up to the client program to fix this. Hence why
I said "you'll have to report it against Gnome".

If you had read crontab(5) as I suggested, then you would know that to
modify the $PATH of a job, one must specify a PATH variable in the
crontab file. You seem to expect Gnome Schedule to do this for you (when
it presumably generates a crontab), but evidently it isn't doing it.
That is clearly not a problem in cron, but in Gnome Schedule.

> After some study of the documentation, I have come to the conclusion
> that cron/crontab is very much in need of a revamp. Certainly, it does
> the job, but then that depends on how the job-requirements are defined.
> To be sure, it is probably very difficult and much more complex than I
> can imagine, but being used to the Windows Task Scheduler I suggest that
> it could be a lot more user-friendly.

I agree that the mode in which cron operates is antiquated.
Nevertheless, it is mandated by POSIX:

http://pubs.opengroup.org/onlinepubs/9699919799/utilities/crontab.html

More powerful job schedulers exist, but the intention behind cron is to
provide a simple, consistent, and ever-present interface in
POSIX-compliant environments.

Regards,
Christian

Revision history for this message
Humphrey van Polanen Petel (hpvpp) wrote :

okay

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.