Operating System - HP-UX
1833738 Members
2410 Online
110063 Solutions
New Discussion

crontab - 6th field - command with spaces -

 
SOLVED
Go to solution
Stephen Badgett
Regular Advisor

crontab - 6th field - command with spaces -

crontab --
would this work in a crontab?

0 17 13 8 6 /home/myuser/scripts/myscript.sh 2>/tmp/ct.log

In other words does the sixth field continue to the end of line? Can the double quotes be used here like an string parameter for a program
Not as is, is now
5 REPLIES 5
Jean-Luc Oudart
Honored Contributor
Solution

Re: crontab - 6th field - command with spaces -

Seems fine to me

refer to crontab man pages :

"The sixth field, command (the balance of a line including blanks in a crontab file),"

Regards,
Jean-Luc
fiat lux
RAC_1
Honored Contributor

Re: crontab - 6th field - command with spaces -

That should work.
Else at the start of your script do
exec 2> /tmp/ct.log

Anil
There is no substitute to HARDWORK
Stephen Badgett
Regular Advisor

Re: crontab - 6th field - command with spaces -

great - thank you
Not as is, is now
Muthukumar_5
Honored Contributor

Re: crontab - 6th field - command with spaces -

Your setting on cron is good.

And more in man page say as,
The sixth field, command (the balance of a line including blanks in a
crontab file), is a string that is executed by the shell at the
specified times. A percent character (%) in this field (unless
escaped by a backslash (\)) is translated to a newline character,
dividing the field into "lines". Only the first "line" (up to a % or
end-of-line) of the command field is executed by the shell. Any other
"lines" are made available to the command as standard input.
Easy to suggest when don't know about the problem!
Stephen Badgett
Regular Advisor

Re: crontab - 6th field - command with spaces -

thank you for the information on this.

Sometimes reading the man pages are not too clear and I have to step away from them to clear the head. It all makes since now


Not as is, is now