$10 PayPal for solution - easy..
Hey hey!
I need a solution for this ASAP and will send $10 by PayPal to the first who gives me a complete solution (from paypal balance = no fee). Anyone? Thanks, Freddy ---------------------------------------------------------------- I have 24 diferrent files : xmlfile1.xml xmlfile2.xml xmlfile3.xml ... ... xmlfile24.xml Every hour, the file /home/xml/xml.xml should be replaced by one of the 24 xmlfiles, but still be named only xml.xml. Every hour, xml.xml should be replaced by the next xmlfile in line. So this should probably be done by using a cronscript and a shell script. The server is redhat 9.0. ------------------------------------------------------------------- |
This'll be homework will it? And don't offer money to our members please, LQ is a community and we do this all for no fee - let's try to avoid setting a precedent.
|
My sincere appologies,
just that I'm in need of an urgent solution.. Best Freddy |
Grab a book on Shell programming and you will probably find this sort of thing as an example. Or look for the equivalent on-line.
I can outline the solution but I can't provide one... however, if you look around your system (say in the "/rc.d/init.d" scripts or any existing cron jobs) you might find one. If you execute the "date" command programmatically, using the backslash {`} mechanism of the shell, you'll get a string. One particular substring is going to be the digits that you want. Extract that piece, build the file-name. Use a "cp" command to copy the file. The destination filename is always the same. All of this is executed by "cron" once an hour. |
Code:
cp /home/xml/xmlfile`date|cut -d' ' -f4|cut -c1-2|sed s/^0//`.xml /home/xml/xml.xml $ crontab -e Add the following line 0 * * * * /etc/cron.hourly/move_xml.sh executes on the hour every hour, every day, 24/7. The back ticks kind of shoot the enclosed part off into its own little shell, then returns the results. The first cut statement grabs the time on the system, and the second pulls only the hour. The sed is needed because single digit hours are prefaced with a 0, but your files don't preface those numbers, so the leading 0 has to be stripped. |
Wow, all that for free. :)
|
THANKS A LOT!!
Please let me know your paypal e-mail.. Best Freddy Quote:
|
Quote:
Do not send your email address. If you want to send receive money, do it away from LQ. |
Yiikes..sorry
Many many thanks to you hobbletoe! Best Freddy |
The thanks are all that I need. I helped because I enjoy figuring out things like this, and I really like to help out where I can. That is also why I explained what everything was doing so that Freddiee and others that stop by the thread can learn and understand it.
I don't have a PayPal account. Money was never the goal, only to help. |
All times are GMT -5. The time now is 12:58 AM. |