Crontab not working on Sun Machine

Posted on 2003-03-03
Medium Priority
Last Modified: 2008-03-04
Hi ,
When i execute Commands such as touch and mkdir from crontab ,it runs fine .But when i try to run tcsh scripts from crontab it fails doing nothing .
What might be the problem ????!!!!

Is the current tcsh might be a problem ???

What might be the possible problems and solution ?

Best Regards ,

Question by:sai_pankaj
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Expert Comment

ID: 8056740

If you run thoose scripts direclty in another shell than tcsh do, are they working then ?

/Hans - Erik Skyttberg
LVL 21

Accepted Solution

tfewster earned 100 total points
ID: 8057036
cron uses sh to run all commands; Ensure that the scripts have
on the first line.

Plus cron does not use your standard environment, so you may have to specify or source environment variables in your scipt

Finally, cron sends any output and error messages to you as a mail message (unless you've explicitly redirected output to a log or to /dev/null), so check your mail for more details of the problem.

Expert Comment

by:Vinit Kain
ID: 8057079
Before executing from crontab, check these steps :-

1. In your script provide the absolute path of each input and output files
2. Give the execute permission to script
3. Check the read and write permission to all the input and output files.

Vinit Kain
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

LVL 51

Expert Comment

ID: 8057152
if cron fails to execute a command, it mails the result to root
please post error messages (and follow previous hints)
LVL 14

Assisted Solution

chris_calabrese earned 100 total points
ID: 8058021
I'm guessing tfewster is closest to the mark here, but I'm going to go one step further.

Not only does cron use /sbin/sh to execute everything, but it does so in a way that makes it impossible to execute scripts in other languages unless you specify the interpreter in the command-line

So, instead of something like

  04 01 * * * /my/script

You'll need something like

  04 04 * * * /usr/bin/tcsh /my/script
LVL 21

Expert Comment

ID: 8058673
OK, enough guessing...although it's fun trying to work out all the possible problems with cron jobs.

Pankaj, please post the line from your crontab file and an example of the script you are trying to run so we can fix the problem.

Expert Comment

ID: 8090862
Chris posted the correct answer. Cron executes all commands using /sbin/sh. This way it ignores whatever interpreter you specify. So you have to specify /usr/bin/tcsh my-script.

Same goes for rc-scripts, just look at /sbin/rcx. All scripts all executed by /sbin/sh. Nice to know when you're trying to figure out why a ksh startup-script isn't working :-)

Featured Post

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello fellow BSD lovers, I've created a patch process for patching openjdk6 for BSD (FreeBSD specifically), although I tried to keep all BSD versions in mind when creating my patch. Welcome to OpenJDK6 on BSD First let me start with a little …
FreeBSD on EC2 FreeBSD (https://www.freebsd.org) is a robust Unix-like operating system that has been around for many years. FreeBSD is available on Amazon EC2 through Amazon Machine Images (AMIs) provided by FreeBSD developer and security office…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Suggested Courses
Course of the Month9 days, 23 hours left to enroll

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question