Sponsored Content
Top Forums Shell Programming and Scripting Script not working when called by cron Post 302288930 by quirkasaurus on Wednesday 18th of February 2009 10:14:15 AM
Old 02-18-2009
probably no good....

maybe just break out these commands into 2:

Code:
string = time.strftime("%m%d%y0000 " + user, time.gmtime())

Code:
string = time.strftime("%m%d%y0000 ", time.gmtime())

string += user

And hopefully see which statement is giving the problem
 

10 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. Shell Programming and Scripting

script not working in CRON

guys i have written a very simple script .it runs manually well. but when i put it in cron,it doesn't give the desired output. script looks like this: #! /usr/bin/sh #script for loading data in table using ctl file/Abhijeet K/08.07.2006 /svm_wl1/. .profile cd... (5 Replies)
Discussion started by: abhijeetkul
5 Replies

5. Shell Programming and Scripting

Shell script not working in cron

Hello, I know little about shell scripting and creating a script, and worked fine in the command line. But not work in the cron. Below you could see the script #!/bin/sh LOGFILE=/home/transfield/mou/test.log # Find yesterday Date and copy files TODAY=$(date --date= +%F) YESTERDAY=$(date... (4 Replies)
Discussion started by: malikp
4 Replies

6. Shell Programming and Scripting

Script is not working from cron while working manually

Hello, I am facing a very strange problem when I run my script manuallu ./Fetchcode which is using to connect with MKS integrity from linux end it workks fine but when I run it from cron it doesn't work.Can someone help me 1) How could I check my script when it is running from cron like... (3 Replies)
Discussion started by: anuragpgtgerman
3 Replies

7. UNIX for Dummies Questions & Answers

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... (2 Replies)
Discussion started by: daveu7
2 Replies

8. Shell Programming and Scripting

Script not working in cron but working fine manually

Help. My script is working fine when executed manually but the cron seems not to catch up the command when registered. The script is as follow: #!/bin/sh for file in file_1.txt file_2.txt file_3.txt do awk '{ print "0" }' $file > tmp.tmp mv tmp.tmp $file done And the cron... (2 Replies)
Discussion started by: jasperux
2 Replies

9. 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

10. 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
GMTIME(P)						     POSIX Programmer's Manual							 GMTIME(P)

NAME
gmtime, gmtime_r - convert a time value to a broken-down UTC time SYNOPSIS
#include <time.h> struct tm *gmtime(const time_t *timer); struct tm *gmtime_r(const time_t *restrict timer, struct tm *restrict result); DESCRIPTION
For gmtime(): The functionality described on this reference page is aligned with the ISO C standard. Any conflict between the require- ments described here and the ISO C standard is unintentional. This volume of IEEE Std 1003.1-2001 defers to the ISO C standard. The gmtime() function shall convert the time in seconds since the Epoch pointed to by timer into a broken-down time, expressed as Coordi- nated Universal Time (UTC). The relationship between a time in seconds since the Epoch used as an argument to gmtime() and the tm structure (defined in the <time.h> header) is that the result shall be as specified in the expression given in the definition of seconds since the Epoch (see the Base Defini- tions volume of IEEE Std 1003.1-2001, Section 4.14, Seconds Since the Epoch), where the names in the structure and in the expression corre- spond. The same relationship shall apply for gmtime_r(). The gmtime() function need not be reentrant. A function that is not required to be reentrant is not required to be thread-safe. The asctime(), ctime(), gmtime(), and localtime() functions shall return values in one of two static objects: a broken-down time structure and an array of type char. Execution of any of the functions may overwrite the information returned in either of these objects by any of the other functions. The gmtime_r() function shall convert the time in seconds since the Epoch pointed to by timer into a broken-down time expressed as Coordi- nated Universal Time (UTC). The broken-down time is stored in the structure referred to by result. The gmtime_r() function shall also return the address of the same structure. RETURN VALUE
Upon successful completion, the gmtime() function shall return a pointer to a struct tm. If an error is detected, gmtime() shall return a null pointer and set errno to indicate the error. Upon successful completion, gmtime_r() shall return the address of the structure pointed to by the argument result. If an error is detected, gmtime_r() shall return a null pointer. ERRORS
The gmtime() function shall fail if: EOVERFLOW The result cannot be represented. The following sections are informative. EXAMPLES
None. APPLICATION USAGE
The gmtime_r() function is thread-safe and returns values in a user-supplied buffer instead of possibly using a static data area that may be overwritten by each call. RATIONALE
None. FUTURE DIRECTIONS
None. SEE ALSO
asctime() , clock() , ctime() , difftime() , localtime() , mktime() , strftime() , strptime() , time() , utime() , the Base Definitions volume of IEEE Std 1003.1-2001, <time.h> COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1, 2003 Edition, Standard for Information Technol- ogy -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html . IEEE
/The Open Group 2003 GMTIME(P)
All times are GMT -4. The time now is 07:58 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy