1 |
On Mon, 25 Feb 2013 21:45:52 +0100 |
2 |
Florian Philipp <lists@×××××××××××.net> wrote: |
3 |
|
4 |
> Am 25.02.2013 21:39, schrieb Joseph: |
5 |
> > I'm updating clock via bash script. When I run it from a command |
6 |
> > line, it works just fine but when I try to run it via crontab I get: |
7 |
> > |
8 |
> > /home/thelma/business/programs/time_date_setting_script.sh: line 3: |
9 |
> > hwclock: command not found |
10 |
> > |
11 |
> > here the script: |
12 |
> > #!/bin/sh |
13 |
> > rdate -s 128.138.140.44 |
14 |
> > hwclock --systohc |
15 |
> > |
16 |
> > and crontab entry: |
17 |
> > 45 12 * * 1 |
18 |
> > sh /home/thelma/business/programs/time_date_setting_script.sh |
19 |
> > |
20 |
> > When I run the scrip manually or just the command: "hwclock |
21 |
> > --systohc" it is working OK; why isn't it working from the crontab? |
22 |
> |
23 |
> I've noticed that cron doesn't have /sbin and /usr/sbin in PATH. Try |
24 |
> using the absolute path to hwclock. |
25 |
|
26 |
With a recent upgrade of fcron, I ran into this problem (and solved it |
27 |
by switching to absolute paths). From fcron's changelog: |
28 |
|
29 |
* don't inherit fcron's environment when running a job but build |
30 |
the environment from scratch (cleaner, and this is what Vixie |
31 |
cron does) |
32 |
|
33 |
I have no idea how the environment is built from scratch, but for me |
34 |
anything run from the system crontab now has $PATH /usr/bin:/bin |