Wednesday, September 27, 2023
 Popular · Latest · Hot · Upcoming
rated 0 times [  27] [ 0]  / answers: 1 / hits: 141229  / 9 Months ago, wed, february 1, 2023, 1:28:03

I have created a file called ntpdate in /etc/cron.hourly

date > /tmp/william_tmp
date > /william_tmp
date > ~/william_tmp
echo test

I also did Chmod 755 to this file.

However, I can't tell if the file has run or not!

The file is not created in any of the 3 directories.

If I manually run cd / && run-parts --report /etc/cron.hourly then the files are created and I get the echo.

Can anyone recommend (ideally step by step!) instructions to test that it is working?

More From » server


One major pitfall to cron is cron runs in an extremely limited shell environment, as a result a lot of variables aren't exported in to the environment, mainly $PATH. Make sure you use all absolute paths to executable, including common functions like echo, uptime, date, etc all need to use full paths (/bin/echo, /bin/date, /usr/bin/uptime). To determine the path to an executable, you can use the which command like so: which echo - this will show you the full path to that tool.

[#37705] Thursday, February 2, 2023, 8 Months  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.

Total Points: 122
Total Questions: 121
Total Answers: 112

Location: Saint Helena
Member since Fri, Aug 26, 2022
1 Year ago