The script runs from command line but crontab fails?

Your script assumes that it is being run from a particular directory (note that almost every path is a relative path, not an absolute path) cron happens to be running it from another directory The Fix If the script works when you run it from the directory it lives in, add the following to the top of your script: mydir=$(dirname "$0") && cd "${mydir}" || exit 1 Explanation $0 is the (possibly relative) filename of the shell script being executed. Given a filename, the dirname command returns the directory containing the filename So, that line changes directories to the directory containing the script or exits with an error code if either dirname or cd fails.

Your script assumes that it is being run from a particular directory (note that almost every path is a relative path, not an absolute path). Cron happens to be running it from another directory. The Fix If the script works when you run it from the directory it lives in, add the following to the top of your script: mydir=$(dirname "$0") && cd "${mydir}" || exit 1 Explanation $0 is the (possibly relative) filename of the shell script being executed.

Given a filename, the dirname command returns the directory containing the filename. So, that line changes directories to the directory containing the script or exits with an error code if either dirname or cd fails.

Looks like you may need to cd into the correct directory at the start of your script. Put a pwd at the beginning, followed by exit and watch the cron output to see where you're executing from. There's also a chance that you have a shorter PATH when running under cron, but it should still have access to tail and grep.

It seems that you are assuming a certain starting directory, and creating a tmp directory there. But when you run it as a cron job, it starts in a different place. So a CD command in your bash startup script might mess you up.

You can easily test by using the full path names when you cd or rm or whatever. For example, if -e "tmp/$AYER. Lnum" ; then rm /home/username/tmp/${AYER}.

* fi # Si existe el archivo con el numero de laultima linea se procesa if -e "/home/username/tmp/$FECHA. Lnum" ; then # Se lee el numero de la linea y se extrae un archivo con las lineas apartir # de la ultima busqueda que se hizo, posteriormente se les hace un grep while read line do tail -n +$line $FILE > "/home/username/tmp/$FECHA. Hal" done "/home/username/tmp/${FECHA}.

New" and so on.

Echo $LINE_NUMBER > "tmp/$FECHA. Mv: cannot move `20110712. /apps/sittel/Alarma/callAlarm: line 69: tmp/20110712.

/apps/sittel/Alarma/callAlarm: line 77: tmp/20110712.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions