Interpreting Shell Script errors when called from CRON


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Interpreting Shell Script errors when called from CRON
# 1  
Old 03-29-2012
Interpreting Shell Script errors when called from CRON

Hi All,

I am calling a series of shell scripts via CRON so everything is running as root. However, in my error log file I am seeing the following errors. Please can anyone offer any advise as to the possible causes and solution to prevent the errors from appearing.

The Error 1227 seems to be called by moving a file from one directory to another but since I am running as CRON and have root permission I am not certain why such an error should be appearing.

The NameVirtualHost *:80 error is cause because I am stopping the web server and then restart it once the whole process has completed.

Not sure what the TERM error or mv: cannot stat errors really mean.

Many thanks for you help.

The log files contains

Code:
[Thu Mar 29 00:45:01 2012] [warn] NameVirtualHost *:80 has no VirtualHosts
ERROR 1227 (42000) at line 5600: Access denied; you need the SUPER privilege for this operation
mv: cannot stat `/home/data/SR1.280312.alpha1.dump.gz': No such file or directory
mv: cannot stat `/home/data/SR1.280312.beta1.dump.gz': No such file or directory
TERM environment variable not set.
[Thu Mar 29 02:38:56 2012] [warn] NameVirtualHost *:80 has no VirtualHosts


Last edited by methyl; 03-29-2012 at 01:41 PM.. Reason: please use code tags
# 2  
Old 03-29-2012
Confirm that your scripts work outside cron.
Setup the required enviroment (SHELL,PATH etc.) inside the script.

The error on mv could be that those files reside on NFS share on which local root will not be able to move (with default NFS export options)

Are you able to execute mv on those files outside the script as root ?

Regards
Peasant.
# 3  
Old 03-29-2012
Quote:
ERROR 1227 (42000) at line 5600: Access denied; you need the SUPER privilege for this operation
That's a MySQL error message. Do you normally access the database as root?

Quote:
TERM environment variable not set.
The TERM message is coming from Shell because there is no value in $TERM (terminal type). This however means that the program is trying to write or read from a real terminal but cron has no terminal context. This can mean that the program is unsuitable for running from cron or that it requires special parameters when run in background.
This User Gave Thanks to methyl For This Post:
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to pass values to a script called from within another script in shell?

Ceiling Light - The Forgotten Element One of the highest details concerning using an LED ceiling panel essentially offer a fantastic dance floor which definitely makes the customers dance right away.They are a quite low cost method of something like a lighting solution, simple collection up,... (1 Reply)
Discussion started by: harveyclayton
1 Replies

2. UNIX for Beginners Questions & Answers

How to pass values to a script called from within another script in shell?

Need ideas on how to achieve the below. We have a script say "profile.sh" which internally calls another existing script called "name.sh" which prompts for the name and age of a person upon execution. When i run profile.sh how can i populate a pre-defined value from another file and pass that... (1 Reply)
Discussion started by: sankasu
1 Replies

3. Shell Programming and Scripting

Shell script to pass the config file lines as variable on the respective called function on a script

I want to make a config file which contain all the paths. i want to read the config file line by line and pass as an argument on my below function. Replace all the path with reading config path line by line and pass in respective functions. how can i achieve that? Kindly guide. ... (6 Replies)
Discussion started by: sadique.manzar
6 Replies

4. Shell Programming and Scripting

Calling bash script works when called manually but not via Cron?

Hi, I've got a Bash backup script I'm trying to run on a directory via a cron job nightly. If I ssh in and run the script manually it works flawlessly. If I set up the cron to run evertything is totally messed up I don't even know where to begin. Basically the path structure is ... (6 Replies)
Discussion started by: wyclef
6 Replies

5. Shell Programming and Scripting

Shell script not getting called through cron job but executes fine manually.

Hi, My shell script not getting called through cron job. The same works fine when executed manually. I tried to generate logs to find if the scripts has some errors related to path using following command- trying to execute .sh file every 5 mins: */5 * * * * /home/myfolder/abc.sh... (17 Replies)
Discussion started by: Dejavu20
17 Replies

6. Shell Programming and Scripting

How to return the value from the called shell script to the calling sh script

Hi all, I have two ksh scripts #sample1.sh #!/bin/ksh . ./sample2.sh echo $fileExist #sample2.sh #!/bin/ksh func() { i=1 return $a } func echo $? Here how should I return the value of sample2.sh back to sample1.sh? Thanks in advance. (2 Replies)
Discussion started by: gp_singh
2 Replies

7. Shell Programming and Scripting

Script not working when called by cron

Hello, I have the following script which works fine when ran from the command line: #!/apps/python/2.3.4/bin/python import os import sys import time user = os.getenv("USER") string = time.strftime("%m%d%y0000 " + user, time.gmtime()) However, when I have this run by crontab, I... (4 Replies)
Discussion started by: cooldude
4 Replies

8. Shell Programming and Scripting

How to determine if a script (perl) was called from a CRON job or commandline

Hi, Is there a way to determine if a Script is called from a CRON job or from a commandline Gerry. (2 Replies)
Discussion started by: jerryMcguire
2 Replies

9. Shell Programming and Scripting

How to determine the script is called from CRON?

Hello expert, What I want is to determine whether the script is called from CRON or it is executed interactively? I tried the following but no luck: #!/bin/ksh cronID=`pgrep -x cron` GPID=`ps -ef -o ppid,pid | grep " $PPID$" | awk '{print $1}'` if ; then echo I am being run... (15 Replies)
Discussion started by: wes_brooks
15 Replies

10. Shell Programming and Scripting

gzip in shell script called by cron

I'm puzzled by this one. I hope you can explain it to me. I have a ksh shell script that gzips a file among other things. This works perfectly fine when the script is manually run through a shell. However, when the same script is run through cron, it does everything correctly, but it will... (2 Replies)
Discussion started by: hbau419
2 Replies
Login or Register to Ask a Question