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
Last edited by methyl; 03-29-2012 at 01:41 PM..
Reason: please use code tags
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)
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)
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)
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)
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)
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)
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)
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)
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
LEARN ABOUT DEBIAN
fstatat
FSTATAT(2) Linux Programmer's Manual FSTATAT(2)NAME
fstatat - get file status relative to a directory file descriptor
SYNOPSIS
#include <fcntl.h> /* Definition of AT_* constants */
#include <sys/stat.h>
int fstatat(int dirfd, const char *pathname, struct stat *buf,
int flags);
Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
fstatat():
Since glibc 2.10:
_XOPEN_SOURCE >= 700 || _POSIX_C_SOURCE >= 200809L
Before glibc 2.10:
_ATFILE_SOURCE
DESCRIPTION
The fstatat() system call operates in exactly the same way as stat(2), except for the differences described in this manual page.
If the pathname given in pathname is relative, then it is interpreted relative to the directory referred to by the file descriptor dirfd
(rather than relative to the current working directory of the calling process, as is done by stat(2) for a relative pathname).
If pathname is relative and dirfd is the special value AT_FDCWD, then pathname is interpreted relative to the current working directory of
the calling process (like stat(2)).
If pathname is absolute, then dirfd is ignored.
flags can either be 0, or include one or more of the following flags ORed:
AT_NO_AUTOMOUNT (since Linux 2.6.38)
Don't automount the terminal ("basename") component of pathname if it is a directory that is an automount point. This allows the
caller to gather attributes of an automount point (rather than the location it would mount). This flag can be used in tools that
scan directories to prevent mass-automounting of a directory of automount points. The AT_NO_AUTOMOUNT flag has no effect if the
mount point has already been mounted over.
AT_SYMLINK_NOFOLLOW
If pathname is a symbolic link, do not dereference it: instead return information about the link itself, like lstat(2). (By
default, fstatat() dereferences symbolic links, like stat(2).)
RETURN VALUE
On success, fstatat() returns 0. On error, -1 is returned and errno is set to indicate the error.
ERRORS
The same errors that occur for stat(2) can also occur for fstatat(). The following additional errors can occur for fstatat():
EBADF dirfd is not a valid file descriptor.
EINVAL Invalid flag specified in flags.
ENOTDIR
pathname is relative and dirfd is a file descriptor referring to a file other than a directory.
VERSIONS
fstatat() was added to Linux in kernel 2.6.16; library support was added to glibc in version 2.4.
CONFORMING TO
POSIX.1-2008. A similar system call exists on Solaris.
NOTES
See openat(2) for an explanation of the need for fstatat().
The underlying system call employed by the glibc fstatat() wrapper function is actually called fstatat64().
SEE ALSO openat(2), stat(2), path_resolution(7), symlink(7)COLOPHON
This page is part of release 3.44 of the Linux man-pages project. A description of the project, and information about reporting bugs, can
be found at http://www.kernel.org/doc/man-pages/.
Linux 2012-05-04 FSTATAT(2)