Problem with executing command inside a cron job


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Problem with executing command inside a cron job
# 1  
Old 12-02-2009
Problem with executing command inside a cron job

Hi All,

I have scheduled a script in cron which writes output to the below file.
....>> /data/Target/wrapper_invoke_ds_job_`date '+%Y%m%d'`.ksh_out 2>&1

But the date command is not getting resolved in the format specified. It just resolves to the following.

wrapper_invoke_MQ_ds_job_Tue Dec 1 23:47:00 EST 2009

The above file is geting resolved properly when echoed from command line.

Kindly help me to overcome the issue.

Thanks,
Pradeep
# 2  
Old 12-03-2009
What OS? maybe something OS specific (with date command...), it works on HP...
# 3  
Old 12-08-2009
Hello,

This may be caused by the % in your crontab line. Check this URL Crontab and % (the percent symbol) (found from google)
# 4  
Old 12-11-2009
Hi All,

It was resolved when I used it as `date +\%Y\%m\%d`.

Thanks,
Pradeep
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Cron Job - date command problem

Hi I have one problem with cron job in Control Panel. I have a log file that is created once a day on another server and I need to transfer it in an exact time to my server so I wrote the cron job for it BUT the problem is in the date command: /filelog-`date +%Y-%m-%d`.tar.gz; The file... (1 Reply)
Discussion started by: bobo_balde
1 Replies

2. UNIX for Dummies Questions & Answers

Executing python scripts via cron job

Hi, I'm executing a python script via cron job. The way it is set up is, I'm editing a file called local00 22 * * * root su - -c "/opt/setup_dir/bin/run_bkp -p" When this job executes, the command-specific logfile and the syslog (where the logs are supposed to go) show half of the logs(no... (2 Replies)
Discussion started by: ashwini.engr07
2 Replies

3. UNIX for Dummies Questions & Answers

Cron job problem

I have a perl script which Im planning to run every minute. I have set the cron job as * * * * * PATH= /usr/local/bin:/usr/bin:/usr/sbin:/usr/lib; perl /dm2/www/html/isos/pre5.3/autoDownload.pl I assume the script is executing every minute only because I see a entry like below when I do... (2 Replies)
Discussion started by: srijith
2 Replies

4. Shell Programming and Scripting

Cron job not executing

I need to add 10 records to database from a file /tmp/authlist.log(contains insert into table sql commands) When i execute the following script manually its executing and working fine. the same is not getting executed when i try to execute using crontab vi /tmp/test1.sh #!/bin/sh... (4 Replies)
Discussion started by: kalyankalyan
4 Replies

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

6. Shell Programming and Scripting

Problem with sar command in cron job

HI, I have a problem with 'sar' command. I am using the sar comman in script.when i execute the script manually using ./filenae, i am getting the desired output. But when i put the script in cron job i am not getting the desired value. Below is the script.. sar > $_LOCATION/sar.txt... (2 Replies)
Discussion started by: ahamed
2 Replies

7. Shell Programming and Scripting

Problem with Cron job

Hi , I have a TCL script which i am supposed to run as a cron job.. The script works fine from command line , but when run as a cron job , its unable to find a package,, my crontab is as follows. --------------------------- #!/usr/bin/ksh * * * * * PATH=/cm8/auto/Automation/Library/TclLib ... (7 Replies)
Discussion started by: Sudharshana
7 Replies

8. Solaris

problem with cron job

new to unix here, im learning how to schedule jobs with crontab. The following cron job runs under root but not under a test account i created. 50 11 * * 0 /usr/bin/banner "HELLO" > /dev/console i have no idea with it isn't running under the test account but runs right on time when i create... (7 Replies)
Discussion started by: solne
7 Replies

9. Solaris

cron job problem

I am trying to setup cronjob and once I start to save it is not working. This is what I am getting after I executed crontab -e, I am not even getting the privious entry and I am running from root. crontab -e 421 10 3 * * * /usr/sbin/logadm ? :wq ? Why is it not saving? Any input is... (4 Replies)
Discussion started by: mokkan
4 Replies

10. Shell Programming and Scripting

Problem in executing a comand liying inside a variable

Hi everyone! I need some help with my shell script :( I am sending a shell command from a html text input to a cgi. Then, I store it into a variable. For example var="ps -axu" echo `$var` This functions properly. But consider the following... var="ps -axu | grep root" Now, I want... (2 Replies)
Discussion started by: Nene
2 Replies
Login or Register to Ask a Question