problem with a script and the cron


 
Thread Tools Search this Thread
Operating Systems AIX problem with a script and the cron
# 1  
Old 10-13-2005
problem with a script and the cron

hello

I use a script to give me the number of users, at each hour.
this script read a file where there is the number of users for each hour and for each month (so 12 files per year).
If i execute the script (root), it is ok, i have xxx users for each hour.
if I put the script in the cron (crontab -e), and kill the cron, the planification is right, the script is executed, but I have "0" user as result for each hour !
I have verified the file's permissions, and chmod 777 for each file, but it's same !!!

can you help me ?

thank you
# 2  
Old 10-13-2005
the biggest problem with scripts in cron is you loos the environment (env) you have as a user

So make sure all the scripts and commands use absolute path
Don't use who use /usr/bin/who etc
If you need to find the command just use type who

Home this helps
Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Execution problem with Cron: Script works manually but not w/Cron. Why?

Hello gurus, I am making what I think is a simple db2 call from within a shell script but I am having difficulty producing the desired report when I run the script shown below from a shell script in cron. For example, my script and the crontab file setup is shown below: #!/bin/ksh db2... (3 Replies)
Discussion started by: okonita
3 Replies

2. Shell Programming and Scripting

Please help me in cron problem

When i am working with cron i given the command as crontab - e | grep runjob.sh.I though my command is wrong and i closed it by ctrl+D.After that when i need to open the cron with crontab -e its not opening its giving some number 22667 and when i given crontab -l its working fine i can see all... (5 Replies)
Discussion started by: bhas85
5 Replies

3. UNIX for Dummies Questions & Answers

Problem automating sFTP transfer using script in cron

Hi Newbie here I am having problems with automating sFTP transfers. Just to save time - SCP is not an option as sFTP is stipulated by controllers of far end server. Ineed to automate sFTP transfer of a single file, once a day to a remote server to which i have no control over. I am using:... (6 Replies)
Discussion started by: robbien
6 Replies

4. Shell Programming and Scripting

Problem with executing a shell script through the cron

Hi, I have a shell script as below: ORACLE_HOME=/usr/local/opt/oracle/product/dev export ORACLE_HOME PATH=$PATH:$ORACLE_HOME/bin:/usr/bin export PATH OUTFILE=/export/home/`basename $0`.out export OUTFILE export IDEN df -k . | tail -1 | read a b c d e f echo $a >> $OUTFILE echo $b... (4 Replies)
Discussion started by: Abhinav Pandey
4 Replies

5. UNIX for Dummies Questions & Answers

Problem with scheduling a shell script on cygwin using cron

Hi, Before I start, I would like to inform that, I went through all FAQs and other threads before posting here. I 'm trying to schedule a shell script on cygwin using cron. No matter what I do I don't seem to get the cron job executing my bash script. My script is temp.sh echo `date` >... (4 Replies)
Discussion started by: shash
4 Replies

6. UNIX for Dummies Questions & Answers

problem when the script is scheduled to run as cron job

Hello, I have problem in executing a shell script. When the shell script is executed at the shell prompt the script works successfully but when the same script is run as a cron job it fails to execute the files called within the shell script. I have scheduled the job in my crontab file as ... (6 Replies)
Discussion started by: forumthreads
6 Replies

7. Shell Programming and Scripting

script execute by cron problem, but manual ok

Hi; I'm facing the problem with my script like below 30 0 * * * /data/SCRIPT/LOADLOGS/loadata1.sh 2 1 >> /tmp/loaddata.txt loadata1.sh calling a another 2 scripts which we need to exe in sequence. when it perform by cron jon, sometimes it just can process 20 recs or less or nothing but... (6 Replies)
Discussion started by: izai
6 Replies

8. Shell Programming and Scripting

CRON problem using script...

Hi! I just write a simple script to kill-restart a process, but when I use CRON to run it, it runs fine for about 1 minute (kill the process and restart it)... then the new process just dissapears!. 5 minutes later (cron prog time) and it does again... up process the disspaear ... This is the... (0 Replies)
Discussion started by: Sorrento
0 Replies

9. Shell Programming and Scripting

Cron Problem

Hello All, One of my shell scripts was working fine till a few days back. It was scheduled in the cron. But yesterday i made some modifications to the script. The script works fine when i run it from the prompt. But it is not working when in runs from cron. Can someone help me out from this. (4 Replies)
Discussion started by: Raiden
4 Replies

10. Shell Programming and Scripting

cron job problem with csh script

I've written a csh shell script to number each line of a file. Firstly, the program count the number of the file and create a file with number at the front. Then, combine the file together. when i call the program manually, it works.However, when i set it in the cronjob, the output always leaves... (3 Replies)
Discussion started by: fung_donald
3 Replies
Login or Register to Ask a Question