LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-16-2016, 07:47 AM   #1
wlourens
LQ Newbie
 
Registered: Mar 2016
Posts: 3

Rep: Reputation: Disabled
crontab test - touch file


Hi

I would like to test if crontab is running by a simple touch file entry, but it is not working:

Crontab entry:
01 * * * * /usr/sap/BHA/HDB00/willem/testcron.bat >> /usr/sap/BHA/HDB00/willem/cronout.txt

Contents of /usr/sap/BHA/HDB00/willem/testcron.bat:

#!/bin/bash
touch /usr/sap/BHA/HDB00/willem/testcron.txt



But the files are not updated:

hostname:HDB:bhaadm /usr/sap/BHA/HDB00/willem 1044> ls -ltr
total 4
-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 14:01 testcron.txt


Kindly assist.

This is on SUSE linux.
 
Old 03-16-2016, 09:09 AM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668
Look at your cron log to see what it did when the time came to run this.

It may be a permission issue. Did you put this in the crontab for user bhaadm or some other user?

It may be it can't find the touch command. You could change the line in your file from touch to /bin/touch to insure it finds it.

FYI: While there is nothing "technically" wrong with naming a script with a .bat since Linux/UNIX don't require extensions or care what they are you should be aware it is more common to name such scripts with .sh to show they are shell scripts vs DOS batch files.
 
1 members found this post helpful.
Old 03-17-2016, 02:20 AM   #3
wlourens
LQ Newbie
 
Registered: Mar 2016
Posts: 3

Original Poster
Rep: Reputation: Disabled
Thanks for your feedback. I made the changes as suggested (also tried using csh shell), unfortunately still not working.
 
Old 03-17-2016, 07:35 AM   #4
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668
Is cron service itself actually running? Run "ps -ef |grep cron".

Did you look at the log (usually /var/log/cron)? If so what does it show?

What Linux distribution (distro) are you running and what version of the distro?
 
Old 03-18-2016, 12:23 AM   #5
wlourens
LQ Newbie
 
Registered: Mar 2016
Posts: 3

Original Poster
Rep: Reputation: Disabled
Solved, issue was not to use leading 0's in the cron

* * * * * /usr/sap/BHA/HDB00/willem/testcron.bat >> /usr/sap/BHA/HDB00/willem/cronout.txt
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
crontab test JROCK1980 *BSD 4 09-24-2012 02:35 PM
touch test{seq 10 10 1000)} lipun4u Programming 10 09-16-2008 03:41 PM
rpmbuild error: File ./test-2.3.0/SOURCES/test-2.3.0.tar.gz: No such file powah Linux - Software 1 12-13-2007 03:30 PM
crontab fedora 3 test 2 james.farrow Fedora 2 10-10-2004 02:46 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:24 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration