The backticks are not required in this context and cause the script to be unpredicatable whether run from the command line or from cron. Also the "echo" is probably not required if you want to get the current date into file ech.txt.
#!/bin/ksh
date > ech.txt
From your later post.
The script does not output anything which is why tempfile.txt is empty. Any syntax errors etc. will be in unix mail for the user issuing the cron.
The cron will of course only execute when it is 11:21 on the 30th of the month.
I tried to invoke Myscript from another script. And i put the calling script(call_Myscript.ksh) in the cron. But in the log(tempfile.txt) i jus get the echo before the script invocation only. None of the echo in Myscript.ksh
goes to the log. both script file permissions are 777.
Either echo the output from your scripts in the scripts themselves, or from the cron job. But not both.
You should also try to fully qualify the logfile you are writing to or the script you are calling instead of just using the filename on its own, escecially important when you expect to run the scripts using cron or other scheduling programs.
And please use code tags. That makes it easier for everyone to read your post.
The first thing you should do is source your .profile in call_Myscript.ksh
cron does NOT automatically source the users profile.
After that, you should do as several others have said. Fully qualify commands and files with paths. You can use variables to do this to simplify things when you need to make changes.
#!/bin/ksh
#
# source the profile.
#
# Note that there is a space between the 1st "." and the tilde "~"
#
. ~/.profile
#
# Define a path to my output files.
#
OUTDIR=/dir1/dir2/output
OUTFILE=${OUTDIR}/tempfile.txt
#
# Echo the date to the file
#
# Note that ">>" will always append to a file. If you want to overwrite the file use ">"
#
date >> ${OUTFILE}