public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-user] hwclock: command not found
@ 2013-02-25 20:39 Joseph
  2013-02-25 20:44 ` Randy Barlow
  2013-02-25 20:45 ` Florian Philipp
  0 siblings, 2 replies; 5+ messages in thread
From: Joseph @ 2013-02-25 20:39 UTC (permalink / raw
  To: gentoo-user

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [gentoo-user] hwclock: command not found
  2013-02-25 20:39 [gentoo-user] hwclock: command not found Joseph
@ 2013-02-25 20:44 ` Randy Barlow
  2013-02-25 21:05   ` Joseph
  2013-02-25 20:45 ` Florian Philipp
  1 sibling, 1 reply; 5+ messages in thread
From: Randy Barlow @ 2013-02-25 20:44 UTC (permalink / raw
  To: gentoo-user

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [gentoo-user] hwclock: command not found
  2013-02-25 20:39 [gentoo-user] hwclock: command not found Joseph
  2013-02-25 20:44 ` Randy Barlow
@ 2013-02-25 20:45 ` Florian Philipp
  2013-02-25 21:39   ` [gentoo-user] " »Q«
  1 sibling, 1 reply; 5+ messages in thread
From: Florian Philipp @ 2013-02-25 20:45 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 753 bytes --]

Am 25.02.2013 21:39, schrieb Joseph:
> 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?
> 

I've noticed that cron doesn't have /sbin and /usr/sbin in PATH. Try
using the absolute path to hwclock.

Regards,
Florian Philipp


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 263 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [gentoo-user] hwclock: command not found
  2013-02-25 20:44 ` Randy Barlow
@ 2013-02-25 21:05   ` Joseph
  0 siblings, 0 replies; 5+ messages in thread
From: Joseph @ 2013-02-25 21:05 UTC (permalink / raw
  To: gentoo-user

On 02/25/13 15:44, Randy Barlow wrote:
>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

That was it, thank you.

-- 
Joseph


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [gentoo-user] Re: hwclock: command not found
  2013-02-25 20:45 ` Florian Philipp
@ 2013-02-25 21:39   ` »Q«
  0 siblings, 0 replies; 5+ messages in thread
From: »Q« @ 2013-02-25 21:39 UTC (permalink / raw
  To: gentoo-user

On Mon, 25 Feb 2013 21:45:52 +0100
Florian Philipp <lists@binarywings.net> wrote:

> Am 25.02.2013 21:39, schrieb Joseph:
> > 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?
> 
> I've noticed that cron doesn't have /sbin and /usr/sbin in PATH. Try
> using the absolute path to hwclock.

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



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-02-25 21:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-25 20:39 [gentoo-user] hwclock: command not found Joseph
2013-02-25 20:44 ` Randy Barlow
2013-02-25 21:05   ` Joseph
2013-02-25 20:45 ` Florian Philipp
2013-02-25 21:39   ` [gentoo-user] " »Q«

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox