Computing.Net > Forums > Unix > Time/date stamping files

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Time/date stamping files

Reply to Message Icon

Name: smiller43147
Date: November 6, 2006 at 13:54:00 Pacific
OS: HP-UX
CPU/Ram: PA-RISC
Product: HP rp7400
Comment:

Can create files w/ Time/date stamps from the shell (touch file_`date +%Y%m%d`) but this does not work when the same command is entered in the crontab.



Sponsored Link
Ads by Google

Response Number 1
Name: nails
Date: November 6, 2006 at 17:40:22 Pacific
Reply:

Typically, when commands/scripts don't work work from the shell and not from cron, it is because the cron environment isn't the same. Generally, it's because cron's PATH is different from your user's PATH.

Also, keep in mind that cron uses the bourne shell as it's default. That's why you are better off placing your touch command in a script like this:

#!/bin/ksh

export PATH=.. # whatever your PATH and shell is

touch file_`date +%Y%m%d`
# end script


0
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: Time/date stamping files

Comparing time/date of a file... www.computing.net/answers/unix/comparing-timedate-of-a-file/3711.html

date-renaming files www.computing.net/answers/unix/daterenaming-files/2549.html

Help! Need help with chron job www.computing.net/answers/unix/help-need-help-with-chron-job/3537.html