473,394 Members | 1,812 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Cron job behaving strangely

1
Well very simply i have a script when i run it manualy from the root it will work but from the crontab. I get an error

The problem is from root i run the script which will define all the env. var. all the needed things and the adabas utility for backup adabck will do its thing and dump the db to a file..all well but...

Why the hell is it giving an error from the cron.. it is loading all the same var. it is running the same script which loads all the same env. var. ... im not sure..

here is the moust simplified script i have used it was larger and more complex but when i started trouble shooting i eliminated all the parts and striped it down to the basic pars needed to run...

this is the backup script that fails... as you will c all the env. var.(sag.profile , assign.bsh) are loaded.. and they do work when i run it man.

Expand|Select|Wrap|Line Numbers
  1. #!/bin/sh
  2. db=DB2
  3. . /usr/local/bin/sag.profile
  4. db=DB2
  5. BCK001=/backup_disk2/db2.todisk
  6. export BCK001
  7. . /SAG/ada/db002/assign.bsh
  8. adabck DB=2 DUMP=* NEW_PLOG 2>&1
  9.  
When i run it in crontab:

Your "cron" job on sun--
/usr/games/mydb2

produced the following output:

stty: : No such device or address
[Setting environment for Adabas Client]
[done]
[Setting environment for Adabas]
[done]
[Setting environment for Natural]
[done]
[Setting environment for Natural Security]
[done]
Reading Merlin Environment
/usr/games/mydb2: test: unknown operator a


ok i get the no stty... cant that be an issue can i redirect or what?
where did he get test? why don't i ever get this error when i run it manually?

i can c only ... stty is different... the env. i think is the same..(when manually running and from cron)..


This is the normal output when i run the script manually:

[Setting environment for Adabas Client]
[done]
[Setting environment for Adabas]
[done]
[Setting environment for Natural]
[done]
[Setting environment for Natural Security]
[done]
Reading Merlin Environment
%ADABCK-I-STARTED, 07-MAR-2010 12:36:42, Version 6.1.8.01 (Solaris 64Bit)
%ADABCK-I-DBON, database 2 accessed online

%ADABCK-I-BKSAVE, saving container ASSO1
........and so on...
Mar 7 '10 #1
4 2996
Hydaral
24
Are you specifying the user in the crontab?

eg:
Expand|Select|Wrap|Line Numbers
  1. * * * * * root [command]
Jun 25 '10 #2
numberwhun
3,509 Expert Mod 2GB
@Hydaral
@Hydaral Cron scripts are inherently run as root. Personally I am not aware that you can specify a user to run them as.
Jun 26 '10 #3
Hydaral
24
It's only used in the system-wide crontab, it's not required for user-specific crontabs, they are run under that user's account.

http://sunoano.name/ws/time.html#sec3
Jun 26 '10 #4
numberwhun
3,509 Expert Mod 2GB
Personally, as a rule, I have never used the user specific crontab. For security purposes (and because only root can access certain resources) I stick strictly to the system cron. So, if root it needed, plop this in the system cron and see if it works instead of trying to specify root
Jun 27 '10 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: sherryonline | last post by:
i have a page and i need that page to be called every day at 12:00 that page is going to connect to the database fetch some emails and will start mailing them how i am goning to do this.
4
by: vagrantbrad | last post by:
I'm using python 2.4 running on Fedora Core 4. I have written a python program called ipscan.py that checks the external ip address of my cable internet connection, and on change, will update the...
3
by: the.natalie | last post by:
Hi. I am a newbie to mysql, cron, and shell scripting, so please bear with me. I have a script that is used for updating an image directory based on contents in a database. The script does the...
2
by: sujitksharma | last post by:
Hi, Following is a simple html which has a table with one "<tr>" and two "<td>". Both the "<td>"s have a fixed width of "150px". In one "<td>" I have put some long text, while in the second "<td>"...
5
by: jcor | last post by:
Hi, I'm trying to run my first cron job, probably it's missing something. I created a perl script just to test, it's called "teste" !/usr/bin/perl open(DATA,">>/home/joao/files/output"); @Now...
4
by: Phil | last post by:
I have a php script that queries some Oracle DB and outputs a single line of plain text with <brat the end for each query. This is Apache2, php4.4.8 and Oracle Instant Client 10.1.0.5 all on CentOS...
4
by: Stephen Cattaneo | last post by:
Hello all, I am attempting to execute an automated test (written in Python) via cron. I have to check the HOSTNAME variable as part of the test, oddly under cron the HOSTNAME environment...
0
by: Cameron Simpson | last post by:
On 17Aug2008 21:25, John Nagle <nagle@animats.comwrote: Because $HOSTNAME is a bash specific variable, set by bash but NOT EXPORTED! Like $0 and a bunch of other "private" variables, subprocesses...
1
by: Karthik Gurusamy | last post by:
Hi, I'm working on a cron like functionality for my application. The outer loops runs continuously waking every x seconds (say x=180, 300, ..). It needs to know what events in cron has expired...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.