On 03/16/2016 07:14 AM, wlourens wrote:[color=blue]
I would like to test if crontab is running with a simple continues touch
file, but it is not working:
Please use the CODE button to put things like code in un-parsed blocks. I
think the button looks like the ‘#’ symbol below the message text field.
01 * * * * /usr/sap/BHA/HDB00/willem/testcron.bat >>
Please do not name files with the .bat extension; it implies something
that is not case, namely that this file is made for a windows interpreter.
File extensions do not really matter in the Linux/Unix world, but if you
are going to use one, use the right one (.sh in this case).
hanaprd-mgmt:HDB:bhaadm /usr/sap/BHA/HDB00/willem 1046> cat
Date of files not updated:
hanaprd-mgmt:HDB:bhaadm /usr/sap/BHA/HDB00/willem 1047> ls -ltr
-rwxrwxrwx 1 bhaadm sapsys 0 Mar 16 13:53 cronout.txt
-rwxrwxrwx 1 bhaadm sapsys 57 Mar 16 13:56 testcron.bat
-rwxrwxrwx 1 bhaadm sapsys 0 Mar 16 15:01 testcron.txt[/color]
Is there a really good reason that permissions are set to 777 on these
files? Maybe it was just for testing to rule out permissions problems,
but this is generally a bad idea. What kind of filesystem do you have
here, and how is it mounted?
This is SUSE linux 11.2[/color]
I presume you mean SUSE Linux Enterprise Server SP2. Just to be clear,
while openSUSE uses the 11.2, 13.1, etc. versioning, SLES only puts the
major version followed by SP whtaever. There are some implied meanings as
a result, but part of the reason I mention it here is that there was an
openSUSE 11.2 way back in the day too, so your versioning could imply an
ancient version of that.
I am not sure why you think the files are not being updated, so please
help me understand what you expected to see above. The timestamp of
testcron.txt is from 15:01, which per your crontab entry is when this
should have run (unless it also ran at 16:01, but there is no way to know
that from what you provided). If your last edits were at 13:56, then this
could have executed at 14:01 (created the file), and then 15:01 (updated
the file) which is what we see above.
I presume you have tested the ‘touch’ command manually to ensure that
timestamps change as you expect when not using cron. If not, please do so
just in case your filesystem is not going to update timestamps for some
I presume you entered your crontab line using the ‘crontab -e’ command to
do this as some user. Which user was that? The permissions on your files
make it such that maybe it will not matter (as long as parent directory
permissions are not preventing access to bhsadm or sapsys members), but
knowing for sure is important. When you do your test of ‘touch’ outside
of crontab, be sure that you use the same user as you expect cron to use.
If you find this post helpful and are logged into the web interface,
show your appreciation and click on the star below…