Cron Job - date command problem


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Cron Job - date command problem
# 1  
Old 01-04-2013
Question 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:

Code:
/filelog-`date +%Y-%m-%d`.tar.gz;

The file name is filelog-2013-01-04 and every day there is a new with a new date on it. But the problem is in my date command, it puts out an error:

Code:
/bin/sh: -c: line 0: unexpected EOF while looking for matching ``'
/bin/sh: -c: line 1: syntax error: unexpected end of file

I need somebody to help me figure out where is the problem?

Thanks!
# 2  
Old 01-04-2013
The percent sign is interpreted as end of line in a crontab. Some implementations of cron allow to escape the percent sign with a backslash. If this doesn't work, then write a small shell script with the date command and call that script from crontab.
This User Gave Thanks to hergp For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

Problem with a cron job

When i am trying to open crontab throught command crontab -e. It is not opening? OUTPUT: # crontab -e sh: vim: not found The crontab file was not changed. Please let me know how to open and edit it??? (10 Replies)
Discussion started by: kkalyan
10 Replies

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

3. UNIX for Dummies Questions & Answers

Cron job not getting yesterday's date

I have this script that gets yesterday's date which runs fine whenever I call it. But when I set this script to run as cron job on 17/9, I noticed that on 18/9, 19/9 it returned the yesterday's date as 2 days' ago date. on 18/9, yesterday's date was returned as 16/9 on 19/9, yesterday's date... (7 Replies)
Discussion started by: viviensiu
7 Replies

4. Shell Programming and Scripting

Cron job running problem

Hi Guys, I am trying to run a script through contab. The script can only be executed once user logs in as su - oracle. I have tested the script other then cronjob and it executes successfully, more over the paths used in the script are absolute paths. Crontab entries are as as below.... (3 Replies)
Discussion started by: Asteroid
3 Replies

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

6. UNIX for Dummies Questions & Answers

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... (3 Replies)
Discussion started by: pkm_oec
3 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. UNIX for Dummies Questions & Answers

Problem running a cron job

I have created a cron job for the vtiger workflow to execute the shell file named com_vtiger_workflow.sh to run the workflow. I've created the following line in crotab -e : 00 13 * * * /var/www/html/prashant/cron/modules/com_vtiger_workflow/com_vtiger_tiger_workflow.sh | mail -s 'Check... (2 Replies)
Discussion started by: anaigini45
2 Replies

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

10. 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
Login or Register to Ask a Question