# sntp cron job

**URL:** <https://forums.suse.com/t/sntp-cron-job/23976>\
**Category:** SLES Configure-Administer\
**Created:** [May 17, 2013, 5:02pm UTC](https://forums.suse.com/t/sntp-cron-job/23976 "2013-05-17T17:02:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![khill1963](https://avatars.discourse-cdn.com/v4/letter/k/2acd7d/32.png) [@khill1963](https://forums.suse.com/u/khill1963)\
**Post date:** [May 17, 2013, 5:02pm UTC](https://forums.suse.com/t/sntp-cron-job/23976/1 "2013-05-17T17:02:15Z")

</div>

ok so i want to schedule a cron job to keep my server in the correct time. i run the following command from a command prompt and it works.  
sntp -v -P no -r [nist.time.nosc.us](http://nist.time.nosc.us) \> /home/tester/time.log 2\>&1 and get the followign output to me log file  
sntp options: a=2 v=1 e=0.100 E=5.000 P=2147483647.000  
d=15 c=5 x=0 op=1 l=/etc/sntp.pid f= [nist.time.nosc.us](http://nist.time.nosc.us)  
sntp: time changed by 2.751 secs to 2013 May 17 08:52:48.049 +/- 0.010+0.037

I then run schedule a cron job by opening up a cron tab by using crontab -u root -e and enter the following  
30 19 \* \* \* sntp -v -P no -r [nist.time.nosc.us](http://nist.time.nosc.us) \> /home/tester/time.log 2\>&1  
When i do that i get the following

/bin/sh: sntp: command not found

So what am i doing wrong?

---

<div class="post-metadata">

**Author:** ![Jens-U](https://avatars.discourse-cdn.com/v4/letter/j/d78d45/32.png) [@Jens-U](https://forums.suse.com/u/Jens-U)\
**Post date:** [May 17, 2013, 5:12pm UTC](https://forums.suse.com/t/sntp-cron-job/23976/2 "2013-05-17T17:12:28Z")

</div>

Hi khill1963,

> /bin/sh: sntp: command not found
> 
> So what am i doing wrong?

cron jobs run with a very limited set of environment variables… including PATH. How about explicitly adding the path to the binary to the command?

```auto
30 19 * * * /usr/sbin/sntp -v -P no -r nist.time.nosc.us > /home/tester/time.log 2>&1
```

As a side note… while it will work as long as the time drift isn’t too bad, running a time update command via a time-based service sounds strange (I’ve done it, too :D). How about simply setting up ntpd to do the job?

Regards,  
Jens
