Sponsored Content
Full Discussion: #!/bin/ksh
Top Forums Shell Programming and Scripting #!/bin/ksh Post 81515 by 98_1LE on Sunday 21st of August 2005 11:57:49 PM
Old 08-22-2005
Generally speaking when a script will run from the command line, but not from cron, it is an environment problem, often PATH. If your script is using environment variables, hard code them in the script and export them.

There is nothing wrong with ksh.

The easiest way to find the problem is to look at the output from the job. Normally this is mailed to the user than the job is running as, but you can also put this at the end of the crontab entry to log everything:
>/tmp/mycron.log 2>&1

If you are still having problems post the output and someone should be able to help.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

#!/bin/ksh

Hi. What does this command do in the shell script? #!/bin/ksh I have some scripts which do not run if this line is removed. First I thought it is comment but I think it sets up korn as shell. Sanjay (2 Replies)
Discussion started by: sanjay_g
2 Replies

2. Shell Programming and Scripting

#!/bin/ksh -e

Can you please tell me what the command "#!/bin/ksh -e" means? I tried running a ksh script with "#!/bin/ksh -e" as starting line, and with "#!/bin/ksh" as starting line - they behave differently.. Thanks! Ramya (2 Replies)
Discussion started by: ramsi_ece
2 Replies

3. Tips and Tutorials

The Whole Story on #! /usr/bin/ksh

Introduction Originally, we only had one shell on unix. When ran a command, the shell would attempt to invoke one of the exec() system calls on it. It the command was an executable, the exec would succeed and the command would run. If the exec() failed, the shell would not give up, instead it... (3 Replies)
Discussion started by: Perderabo
3 Replies

4. Shell Programming and Scripting

#!/bin/sh and #!/bin/ksh

Hi All, I have a shell (#!/bin/sh) with below piece of code: if ! then echo Staging table ABC_INT_TAB is not present in the schema >> $OUTPUT fi Shell is throwning below error and continue to work even after this error... (3 Replies)
Discussion started by: bhush782003
3 Replies

5. Shell Programming and Scripting

/bin/sh and /bin/ksh problem

we have a shell script that we are using in KSH if ]; then _IFS=$IFS IFS=: and it's failing on /bin/sh . Is there a simple way to modify it to work on both . ( not with awk) Thanks in adv (3 Replies)
Discussion started by: talashil
3 Replies

6. UNIX for Dummies Questions & Answers

fuser: difference with bin/sh and bin/ksh shell script

Hi, I have a problem I don't understand with fuser. I launch a simple shell script mysleep.sh: I launch the command fuser -fu mysleep.sh but fuser doesn't return anything excepted: mysleep: Then I modify my script switching from #!/bin/sh to #!/bin/ksh I launch the command fuser -fu... (4 Replies)
Discussion started by: Peuj
4 Replies

7. Shell Programming and Scripting

/bin/ksh: scriptname: not found. ???

I have started to write Korn scripts on the client's AIX 4.2 servers and there is this small problem that puzzles me. I code all my scripts the same way: - first line contains : #!/bin/ksh - I do this console command on every scripts: chmod +x scriptname But still, on some occasions,... (4 Replies)
Discussion started by: Browser_ice
4 Replies

8. Shell Programming and Scripting

meaning of #!/bin/ksh -p

:b:HI Friends, Can you help me understand -p option with /usr/bin/ksh shell interpreter ? Thanks, Panditt (1 Reply)
Discussion started by: deshaipet
1 Replies

9. UNIX for Dummies Questions & Answers

Usage of #!/bin/ksh

Hi, In the beginning of Shell script, we give a statement like #!/bin/ksh I have 2 questions related to this, 1) It could denote about the shell we want to use, what is the real usage of this? My shell script works even without this statement, is it a mandatory one. 2) I'm using... (7 Replies)
Discussion started by: Dev_Dev
7 Replies

10. Shell Programming and Scripting

/usr/bin/ksh -E

I saw one script using the first line as below /usr/bin/ksh -E I have used -x for debug but couldn't find what is this -E option for ? Pls let me know what is this -E used for Thanks RL (1 Reply)
Discussion started by: reldb
1 Replies
CRON(8) 						    BSD System Manager's Manual 						   CRON(8)

NAME
cron -- daemon to execute scheduled commands (ISC Cron V4.1) SYNOPSIS
cron [-n] [-x debugflags] DESCRIPTION
cron is normally started during system boot by rc.d(8) framework, if cron is switched on in rc.conf(5). It will return immediately so you don't have to start it with '&'. cron searches /var/cron/tabs for crontab files which are named after accounts in /etc/passwd. Crontabs found are loaded into memory. cron also searches for /etc/crontab which is in a different format (see crontab(5)). Finally cron looks for crontabs in /etc/cron.d if it exists, and executes each file as a crontab. When cron looks in a directory for crontabs (either in /var/cron/tabs or /etc/cron.d) it will not process files that: - Start with a '.' or a '#'. - End with a '~' or with ``.rpmsave'', ``.rpmorig'', or ``.rpmnew''. - Are of zero length. - Their length is greater than MAXNAMLEN. cron then wakes up every minute, examining all stored crontabs, checking each command to see if it should be run in the current minute. When executing commands, any output is mailed to the owner of the crontab (or to the user named in the MAILTO environment variable in the crontab, if such exists). Events such as START and FINISH are recorded in the /var/log/cron log file with date and time details. This information is useful for a num- ber of reasons, such as determining the amount of time required to run a particular job. By default, root has an hourly job that rotates these log files with compression to preserve disk space. Additionally, cron checks each minute to see if its spool directory's modtime (or the modtime on /etc/crontab or /etc/cron.d) has changed, and if it has, cron will then examine the modtime on all crontabs and reload those which have changed. Thus cron need not be restarted when- ever a crontab file is modified. Note that the crontab(1) command updates the modtime of the spool directory whenever it changes a crontab. The following options are available: -x This flag turns on some debugging flags. debugflags is comma-separated list of debugging flags to turn on. If a flag is turned on, cron writes some additional debugging information to system log during its work. Available debugging flags are: sch scheduling proc process control pars parsing load database loading misc miscellaneous test test mode - do not actually execute any commands bit show how various bits are set (long) ext print extended debugging information -n Stay in the foreground and don't daemonize cron. Daylight Saving Time and other time changes Local time changes of less than three hours, such as those caused by the start or end of Daylight Saving Time, are handled specially. This only applies to jobs that run at a specific time and jobs that are run with a granularity greater than one hour. Jobs that run more fre- quently are scheduled normally. If time has moved forward, those jobs that would have run in the interval that has been skipped will be run immediately. Conversely, if time has moved backward, care is taken to avoid running jobs twice. Time changes of more than 3 hours are considered to be corrections to the clock or timezone, and the new time is used immediately. SIGNALS
On receipt of a SIGHUP, the cron daemon will close and reopen its log file. This is useful in scripts which rotate and age log files. Natu- rally this is not relevant if cron was built to use syslog(3). FILES
/var/cron/tabs cron spool directory /etc/crontab system crontab file /etc/cron.d/ system crontab directory /var/log/cron log file for cron events SEE ALSO
crontab(1), crontab(5) AUTHORS
Paul Vixie <vixie@isc.org> BSD
October 12, 2011 BSD
All times are GMT -4. The time now is 03:43 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy