Sponsored Content
Top Forums Shell Programming and Scripting Perl script, replace file with newer file Post 302662739 by arrals_vl on Wednesday 27th of June 2012 05:06:56 AM
Old 06-27-2012
Perl script, replace file with newer file

Hello,

Can you please help me one this:

I have two servers: Server A and server B.
Every day on 03.00AM in only one on these two servers (randomly)is generated one file, lets say file.txt.
I want to copy this file also to the other server.

I want to create a perl script that does this:
To see if the file file .txt that is generated is up to date.
If so, to copy this file to the other server.

Thank you in advance!!
Ervin
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

If condition to check one file newer than the other - first file name uncertain

Dear All, I'm new to unix scripting. I'm trying to write an utility script which has to check if one file is newer than another one. The condition is I dont know the full name of the first file. I searched google and this forum for any such examples, but couldn't find any or may be I would have... (9 Replies)
Discussion started by: achilles5
9 Replies

2. Shell Programming and Scripting

How to script to find the newer date in a text file?

Hi, I have a text file, foo.txt, it looks something like below. In the file there is a line that gives the date in the form of: Mon Jun 15 11:09:31 2008. I need to find which date is the newest and then store certain details of that list data to another file. So, in this sample text file, I... (6 Replies)
Discussion started by: boolean2222
6 Replies

3. Shell Programming and Scripting

How to replace a value in a file in perl?

Hi, I have a file with the following contents and i want to replace that value in a file with some other value. #file.txt /local/Disk/data n 192.168.55.98 52035 3 1 2 1 1 192.168.55.98 Here is my code. (2 Replies)
Discussion started by: vanitham
2 Replies

4. Shell Programming and Scripting

how to find a file then overwrite with a newer version

This should be a simple script, but can't find one with google search. I just need to find the file that is in many directories, then overwrite that file with a newer version i.e. find file.jar then overwrite with /root/file.jar All I get in searches is substitute text with new test inside... (1 Reply)
Discussion started by: haircat
1 Replies

5. UNIX for Dummies Questions & Answers

Replace line via perl script of file

Hi All, I wanted to do following. 1) If file exit then open file for reading and check if my string is there then i wanted to replace the entire line with that string + something else then close the file. 2) If file does not exit then i need to open the file and write to it. I am done with... (0 Replies)
Discussion started by: Tarun24
0 Replies

6. Shell Programming and Scripting

script to grep a pattern from file compare contents with another file and replace

Hi All, Need help on this I have 2 files one file file1 which has several entries as : define service{ hostgroup_name !host1,!host5,!host6,.* service_description check_nrpe } define service{ hostgroup_name !host2,!host4,!host6,.* service_description check_opt } another... (2 Replies)
Discussion started by: namitai
2 Replies

7. Shell Programming and Scripting

perl script to replace the text in the original file

Hi Folks, I have an html file which contains the below line in the body tagI am trying the replace hello with Hello Giridhar programatically. <body> <P><STRONG><FONT face="comic sans ms,cursive,sans-serif"><EM>Hello</EM></FONT></STRONG></P> </body> I have written the below code to... (3 Replies)
Discussion started by: giridhar276
3 Replies

8. UNIX for Dummies Questions & Answers

If condition to check one file newer than the other

Dear All, I'm new to unix scripting. I'm trying to write an utility script which has to check if one file is newer than another one. $3 $4 $5 $6 are files .txt. Help me please. for i in $3 $4 $5 $6 do if then echo "$1 is newer than $i" else echo "$i is newer than $1" fi (9 Replies)
Discussion started by: Manueldo
9 Replies

9. Shell Programming and Scripting

Perl script to read string from file#1 and find/replace in file#2

Hello Forum. I have a file called abc.sed with the following commands; s/1/one/g s/2/two/g ... I also have a second file called abc.dat and would like to substitute all occurrences of "1 with one", "2 with two", etc and create a new file called abc_new.dat sed -f abc.sed abc.dat >... (10 Replies)
Discussion started by: pchang
10 Replies

10. Shell Programming and Scripting

Copy file only if newer

I only want the file copied if it is newer. But it still copies the file? zip -u Ubuntu_Documents.zip ./* cp -u Ubuntu_Documents.zip $DOCS_Backup/Ubuntu_Documents_`date +"%Y-%m-%d-%H-%M"`.zip (5 Replies)
Discussion started by: drew77
5 Replies
SETUP-DS.PL(8)						      System Manager's Manual						    SETUP-DS.PL(8)

NAME
setup-ds.pl - Set up an instance of Directory Server SYNOPSIS
setup-ds.pl [--options] -- [args] DESCRIPTION
Set up a Directory Server instance. Creates the configuration files for an instance of Directory Server based on a few parameters like the hostname, port number, and directory manager information. Can be run in interactive mode with different levels of verbosity, or in silent mode with parameters supplied in a .inf format file or on the command line. OPTIONS
A summary of options is included below: --help This message --version Print the version and exit --debug Turn on debugging --silent Use silent setup - no user input --file=name Use the file 'name' in .inf format to supply the default answers --keepcache Do not delete the temporary .inf file generated by this program --logfile Log setup messages to this file - otherwise, a temp file will be used --update Update existing installations - add/update schema files, add/change configuration, add new instance scripts, etc. You must run set- up-ds.pl -u after upgrading your packages. You will usually have to restart your servers in order for all of the changes to take effect (e.g. adding/changing plug-in configuration), so schedule this when you can afford a little downtime. --continue (Update only) Keep going even if errors occur. You will usually not need to use this option unless your installation is broken and you need to force it to update in order to fix it. For all options, you can also use the short name e.g. -h, -d, etc. For the -d argument, specifying it more than once will increase the debug level e.g. -ddddd args: You can supply default .inf data in this format: section.param=value e.g. General.FullMachineName=foo.example.com or "slapd.Suffix=dc=example, dc=com" Values passed in this manner will override values in an .inf file given with the -f argument. UPDATES
The update process (setup-ds.pl -u) can work in one of two modes: Online: Configuration changes are made to the running directory servers using LDAP. The operations must be performed as an administrative user. You must provide the name and password, for each instance if there is more than one instance of directory server. Some changes (e.g. plug-ins) may require a directory server restart to take effect. The update script will notify you if a restart is required. Offline: The changes are made to the server configuration files. The servers MUST FIRST BE SHUTDOWN BY YOU. The script will not shutdown the servers for you. You MUST shutdown the servers in order to use this mode. A username and password are not required to use Offline mode. If the servers are not shutdown, CHANGES WILL BE LOST. To summarize: Online - servers remain running - you must provide admin name and password for each server - servers may need to be restarted Offline - servers must be shutdown - no username or password required AUTHOR
setup-ds.pl was written by the 389 Project. REPORTING BUGS
Report bugs to http://bugzilla.redhat.com. COPYRIGHT
Copyright (C) 2008 Red Hat, Inc. This manual page was written by Michele Baldessari <michele@pupazzo.org>, for the Debian project (but may be used by others). This is free software. You may redistribute copies of it under the terms of the Directory Server license found in the LICENSE file of this software distribution. This license is essentially the GNU General Public License version 2 with an exception for plug-in distribution. May 18, 2008 SETUP-DS.PL(8)
All times are GMT -4. The time now is 08:48 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy