Routine doesn't give output when executed in crontab


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Routine doesn't give output when executed in crontab
# 1  
Old 02-12-2008
Routine doesn't give output when executed in crontab

I have a script running in the crontab that gets data from a database every hour. Now I would like to execute a fortran routine to process the data in some way, after getting it and saving it locally.

I have added the following commands to my script:

set convert = ${outputdir}/Scripts/data_latest.txt

cd ${outputdir}/Scripts
f90 -o routine.x routine.f
routine.x filename.dat > $convert


The output from the routine should be written in the 'convert' file, which is data_latest.txt. The file 'filename.dat' is the input file which was received from the database. When I run the script separately, the 'convert' file is filled with output, but when the script is executed in the crontab, it is completely empty.

What should I do in order to run this routine (embedded in the script) automatically and receive my output in the output file?

Thanks in advance.
# 2  
Old 02-12-2008
Including ">$outputfile" in your script works fine in case only one output file was originally generated by the Fortran routine. But what should I do when I would like to have two different output files generated in the program? Is it possible to discriminate between different kinds of output, or should I run the program twice (once for each file)?

Anyone with a solution? Thanks in advance.

Last edited by SharkM; 06-05-2008 at 12:22 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to detect and fix why crontab job is not executed?

I have set several cron jobs. I recently added a new cron job that copies a file of last day from another server and is executed each day (for example at 04:00 am) but when I check next day the file hasn't been copied. I'm working in GNU/Linux CentOS (2.6.32) system. The files that I need to... (23 Replies)
Discussion started by: Ophiuchus
23 Replies

2. Shell Programming and Scripting

Script containing Curl doesn't run with crontab

Hello I have a problem with the crontab command when I run a code containing Curl on the command line it runs without fail but as soon as I program it with crontab it executes everything except the curl returns fail thank you for helping me to resolve this problem because since Monday I look... (14 Replies)
Discussion started by: beautymind
14 Replies

3. Shell Programming and Scripting

How to give full access to output files created by .sh script run via crontab?

Hi Expert, I have a .sh script in my home/new_dir/script.sh This script creates number of output files at home/new_dir/email, home/new_dir/logs dir. I am running this script using crontab (owner root). Now this output files are getting created with rw-r----- 1 root root So if i... (2 Replies)
Discussion started by: Jeet1982
2 Replies

4. Shell Programming and Scripting

crontab job not executed with variables

Hi, I am trying to execute a script (for once) during the booting time in Ubuntu system. However, the result is only showing the strings without without the variables. Here is the script: MgrIp=$(ec2-describe-instances --filter tag:Name=Mgr --filter instance-state-name=running | egrep... (4 Replies)
Discussion started by: turki_00
4 Replies

5. Shell Programming and Scripting

Users who desire to have their .profile executed must explicitly do so in the crontab entry. Why?

The .profile file should be read when the user logs in. So, there should be no need to execute .profile file again in a cron job (since the cron job is run after the user logs in). Doesn't the cron require login from the user. Then, from where does the cron execute? Please help!! (1 Reply)
Discussion started by: thulasidharan2k
1 Replies

6. Shell Programming and Scripting

crontab doesn't allow `command` ??

Dear All, We wrote a script to clean email mailbox when they're nearly full and put it in cron : 0 0 * * * /root/quota/autoclean.sh > /root/quota/autoclean.`date '+%Y%m%d'` 2>&1 I've run this command from command prompt, it did work. However, if running from cron, it returned such error... (1 Reply)
Discussion started by: tiger2000
1 Replies

7. Shell Programming and Scripting

IDL job doesn't work from crontab

I have made a script to execute an IDL routine with the purpose to plot data on a fixed time. The problem is that when I include this script in the crontab to run it every night, the IDL part doesn't work (the other commands, like getting data from the database, are carried out though). This... (4 Replies)
Discussion started by: SharkM
4 Replies

8. Shell Programming and Scripting

When things doesn't run into crontab???

Could someone explain my problem? I've the following script... #! /bin/ksh ... vmquery -m $MediaID | awk ' BEGIN {FS=": " getline expdate <"ExpDate.txt" } $1 ~ /media ID/ {MediaNumber = $NF} ... $1 ~ /number of mounts/ { "date +%Y"|getline YearToday Year4 = YearToday - 4 if... (4 Replies)
Discussion started by: nymus7
4 Replies

9. Shell Programming and Scripting

bash scripting cannot executed in crontab

hi guys, i have a problem. a week ago i made a successful crontab that execute bash scripting daily, it worked well but now, it doesn't work at all, in the mail i have: " /home/jimmy/cha/scripts/cekpderr produced the following output: lagi jalan /home/jimmy/cha/scripts/cekpderr:... (6 Replies)
Discussion started by: jimmbp
6 Replies

10. Shell Programming and Scripting

Shell script doesn't get executed using crontab

I have the following crontab entry to run a shell script for every 30 minutes of every day: 30 * * * * $HOME/main.sh > $HOME/main.log 2>$HOME/error.log after I created the crontab file I have also done: $crontab my_crontab I also check to make sure it exists, by using the following... (11 Replies)
Discussion started by: radhika
11 Replies
Login or Register to Ask a Question