get system date, format it, pass it as a parameter to a perl script - all in cron job
I am trying to get the string containing date - in a specfic format actually, although I think that part is inconsequencial -
- through echo or printf or in some other way - created within a cront job and passed as a parameter to a perl script.
Now, I know it would probably be easier to manipulate the date within that perl script, but I would rather not touch it and pass parameters to it instead - this way I don't have to change the script every time I need a different parameter.
Here is how I get that string at command line:
Here is the cron job
Here is what cron says:
It looks like it is not reading % correctly - do I need something like backslashes in front of those or something?
---------- Post updated at 07:12 PM ---------- Previous update was at 07:02 PM ----------
OK, put the back slashes in front of % signs
Here is what cron says:
Although it did read the whole thing and invokes perl and everything else - only that parameter was not created correctly.
---------- Post updated at 08:20 PM ---------- Previous update was at 07:12 PM ----------
It took it -
Last edited by Scott; 02-26-2011 at 10:33 PM..
Reason: Please use code tags.
Hi,
I have a requirement where I have to pass Date to a script and get the day from it.
Ex If parameter is 2015-09-29
The output should be Tuesday.
Can you please tell me how to get that? (6 Replies)
Hi ,
I have to schedule one job in crontab, but with two parameters.
1. Sysdate in YYYYMMDD format
2. Sysdate - 7 in YYYYMMDD format
Please suggest how to do that.
Thanks in advance. (1 Reply)
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)
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)
Hello All,
Hope all is fine. I am newbie to Unix. I am using Bourne Shell (sh). One of the question I have is that I am trying to read XML file and based on reading that XML file I want to run same java programs at different hours. When I run the Java code, I wanted to pass parameters to my... (1 Reply)
Hello evreyone,
this is my first post, and to say i'm new to this is an understatement.
I know very little about perl scripts and hope some one can help me.
i'm looking to get a script that a cron job can execute.
what the script needs to to is
1) connect to a mysql database
2) go to a... (2 Replies)
Hi Experts,
I'm a SAP Basis, I have a small doubt would request you please help on this...
1. I wold like to copy files from one system to another system?
as per my knowledge "we have to mount the prod filesystem on the quality box and do a copy every day thru crontab script, or do it via... (2 Replies)
Although there are many threads on this forum regarding cron, none have specifically answered my question. So hopefully someone can shed some light on what I'm doing wrong..
I have a perl script that I want to run in a cron job. Since I've read that cron doesn't have any environments set, I... (3 Replies)
I want to know if there is a way to make a certain set of programs start in order at system startup with cron or something else i dont know about. (3 Replies)