Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[gentoo-user] hwclock: command not found

480 views
Skip to first unread message

Joseph

unread,
Feb 25, 2013, 3:40:02 PM2/25/13
to
I'm updating clock via bash script. When I run it from a command line, it works just fine but when I try to run it via crontab I get:

/home/thelma/business/programs/time_date_setting_script.sh: line 3: hwclock: command not found

here the script:
#!/bin/sh
rdate -s 128.138.140.44
hwclock --systohc

and crontab entry:
45 12 * * 1 sh /home/thelma/business/programs/time_date_setting_script.sh

When I run the scrip manually or just the command: "hwclock --systohc" it is working OK; why isn't it working from the crontab?

--
Joseph

Florian Philipp

unread,
Feb 25, 2013, 3:50:02 PM2/25/13
to
I've noticed that cron doesn't have /sbin and /usr/sbin in PATH. Try
using the absolute path to hwclock.

Regards,
Florian Philipp

signature.asc

Randy Barlow

unread,
Feb 25, 2013, 3:50:01 PM2/25/13
to
On Mon, 25 Feb 2013, Joseph wrote:
> I'm updating clock via bash script. When I run it from a command line, it
> works just fine but when I try to run it via crontab I get:
>
> /home/thelma/business/programs/time_date_setting_script.sh: line 3: hwclock:
> command not found

Could it be that cron doesn't have this command on its PATH? Might be
best to put the full path to hwclock instead of just "hwclock".

--
R

Joseph

unread,
Feb 25, 2013, 4:10:02 PM2/25/13
to
That was it, thank you.

--
Joseph

»Q«

unread,
Feb 25, 2013, 4:50:02 PM2/25/13
to
With a recent upgrade of fcron, I ran into this problem (and solved it
by switching to absolute paths). From fcron's changelog:

* don't inherit fcron's environment when running a job but build
the environment from scratch (cleaner, and this is what Vixie
cron does)

I have no idea how the environment is built from scratch, but for me
anything run from the system crontab now has $PATH /usr/bin:/bin
0 new messages