Help with troubleshooting crontab


 
Thread Tools Search this Thread
Operating Systems Linux Ubuntu Help with troubleshooting crontab
# 1  
Old 09-23-2010
Error Help with troubleshooting crontab

Hello all,

When I configured cron jobs that execute bash scripts a while back on my box they worked and the other day I tried to enable cron jobs that execute a bash script to run with no success.

cron text file:
Quote:
SHELL=/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

0-59 * * * * date >>/tmp/date.log 2>&1
0-59 * * * * /usr/local/bin/sensor-rpt/test.sh >/dev/null 2>&1
test.sh file
Quote:
#!/usr/bash
#
#PATH=/sbin:/bin:/usr/sbin:/usr/bin
#export PATH
#
ts=`date +%s`
#
#
echo "$ts" >> "/usr/local/bin/sensor-rpt/test.txt
The script has execution rights (e.g. if I use bash /usr/local/bin/sensor-rpt/test.sh) it outputs the timestamp to a file. The first job "date" outputs it's file to the tmp directory and dates are getting appended when executed by crontab.

I also tried adding my user to the crontab group and it still didn't resolve the problem. Any advice would be greatly appreciated.
# 2  
Old 09-24-2010
It's likely the #!/usr/bash is incorrect. You'd not have a problem if you use the command line 'bash scriptname' as that invokes bash directly and #! is not examined.

I prefer this method of specifying the interpreter:

Code:
#!/usr/bin/env bash

as it allows bash (or other interpreter) to be selected based on the path and not necessarily what is installed as the default on the host -- very handy when testing etc.

Try changing the #! and if that doesn't help, change your redirection from /dev/null to a real file and see what error messages are generated.
# 3  
Old 09-24-2010
I gave your suggestion a try with no success. I'll take a look at the FAQ post to see what I can try: https://www.unix.com/answers-frequent...n-crontab.html

It's just odd because my original post worked about a month ago. I'm not certain what changed and it works on my other Ubuntu box.

Last edited by LAVco; 09-24-2010 at 07:48 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Troubleshooting whiptail

Here is a code snippet using whiptail , it fails to complete giving me long list of options available for whiptail . That is great, but how do I determine which of the current opinions is wrong? I did tried inserting comment (#) into options and it just did not work. Deleting the option... (9 Replies)
Discussion started by: annacreek
9 Replies

2. IP Networking

TCP/IP troubleshooting

Hello all, Can somebody please tell what is the best book out there that can help me learn TCP troubleshooting and understaning the TCP options like window scaling, large receive offload? I would like to understand how all the TCP tuning parameters function. Is there a book out there that can... (4 Replies)
Discussion started by: Pouchie1
4 Replies

3. Solaris

prtdiag -v troubleshooting

selected lines from the output of the "prtdiag -v" command on a T5240 SUN server running Solaris 10. Are the following known as FRU names and what do they mean? MB/CMP0/BR0/CH0/D0 MB/CMP0/BR0/CH1/D0 SYS/FANBD0/FM0/F0 SYS/FANBD0/FM0/F1 SYS/MB/CMP0/BR1/CH0/D1 ... (1 Reply)
Discussion started by: snoman1
1 Replies

4. AIX

iSCSI troubleshooting

I have an Equallogic SAN that I connect to from AIX (as well as Windows) I had configured the connection and created the volumes and filesystems and all was working great. Then one day, no communication between the SAN and the AIX (I can ping though) Anything I do on the AIX box at this time... (2 Replies)
Discussion started by: oldmanjoe
2 Replies

5. AIX

How to Troubleshooting IO in AIX 6.xx

I am running Oracle databases and recently have been facing slow IO response. I know in 11g one can run calibrate_IO from within DB and it would have given me some data for IO, but DB is 10g. Is there any tool available which can give me max MBPS, max IO requests per second system can handle and... (1 Reply)
Discussion started by: clifford
1 Replies

6. AIX

AIX troubleshooting

Hi guys, Is there a command in AIX similar to ps, but shows memory usage by application? I'm trying to track down a rogue application that's using up all 32GB of the available systems memory and causing the the system to page to disk. (4 Replies)
Discussion started by: bbbngowc
4 Replies

7. Solaris

help troubleshooting

Hi. I have a Solaris 10 server that's taking about 20secs to respond to telnet or ftp commands. Has anyone ever seen something like that? Can you tell me where to start troubleshooting please? I logged in and did a prtstat, but nothing is jumping out as an issue. (8 Replies)
Discussion started by: bbbngowc
8 Replies

8. UNIX for Dummies Questions & Answers

tftp troubleshooting

Hi I am trying to do a network install of Solaris 10 08_07 onto a Sunfire T2000. I have configured all my network-boot-arguments on the client server (named sundb1). I have installed my image of Solaris on my install server (sun1). But when I try to install using # boot net -s I get the... (0 Replies)
Discussion started by: Bobby76
0 Replies

9. Shell Programming and Scripting

Troubleshooting Script

I am fairly new to Unix (Sun OS) scripting with Ksh, and I could use a little help troubleshooting my script. When I run it, I get the error "if unexpected" on the function setYear. If I comment out the setYear function, I get the error "for unexpected" on the function sendEmails. This leads me... (8 Replies)
Discussion started by: mharley
8 Replies

10. UNIX for Advanced & Expert Users

Networking troubleshooting

How can i tell how long my network cards have been connected to the network for. (1 Reply)
Discussion started by: manwithaphone
1 Replies
Login or Register to Ask a Question