Programming :: Write A Shell Script Which Will Check A File Name In A Dir And Copy It?

Apr 2, 2010

I am a novice to the shell script. In my system from db server the log files are enerating with the name log1.txt,log2.txt..... It is capable of keeping 10 files at a time in dir called /db/sis/log1.txt. I want to copy the log1.txt to another directory when ever it generating by attaching the time stamp to it for the back-up purpose. this files will be there for a period of 24 hours. after that the back-up dir should be cleared and it start copying again the fresh file from the same dir.

View 3 Replies


ADVERTISEMENT

Programming :: Write Shell Script For Copy Files?

Mar 25, 2010

write shell script for copy files to usbdąsk that cosist of very long argument like "2009025_efkl".

View 1 Replies View Related

General :: Write Shell Script To Check The Modified Date Of A File ?

Jun 17, 2011

I have two linux servers, they are backup together.

1. Server 1 have 3 files with name: file1, file2, file3 in the path: /etc/sysconfig/network-script/.

2. Server 2 have 3 files with name and path are the same as server 1.

- How to make a script to copy 3 files at server1 to overwrite on server2. But before overwrite, this script will check and compare the last modified date of these 3 files(on server1 and server2). if the modified date of file1, file2 or file3 on server1 is newer than 3 files on server2 then overwrite process will do, if not, will do nothing.

- see my script as below: it works find now but just overwrite. not check last modified date.

View 1 Replies View Related

Programming :: Shell Script / How To Check File Size?

Jan 21, 2009

I have a file that's supposed to be growing in size 24/7. I want to check every 10 minutes via cron that it's actually growing. If not, send an email. Does anyone know how to write a script to do that?

View 3 Replies View Related

Programming :: Write A Shell Script Which Edits A Config File ?

Mar 1, 2011

Write some simple script?

Heres what Im trying to do:

-Qjackctl has a config file which is modified each time QjackCtl is shut down. This means that whatever preset is in use when QjackCtl closes is written into the QjackCtl config file as the DEFAULT PRESET, for the next time QjackCtl starts (or at least this is how I understand it).

-I want to edit a specific line in the QjackCtl.config file, which specifies the DEFAULT PRESET. Obviously its easy to do manually, but I want to do it using a shell script which runs automatically on StartUp so that QjackCtl starts every time with the same DEFAULT PRESET, NOT the last one used.

-Unfortunately Im not at my Linux system right now (which is KXStudio/Kubuntu), but I believe the QjackCtl.config line looks something like this: DEF_PRESET=alsa (where alsa is the name of the preset)

PRESET1=alsa
PRESET2=firewire

I want a shell script which changes the line DEF_PRESET=alsa to DEF_PRESET=alsa, even when it may currently exist as DEF_PRESET=firewire due to occasions when firewire was the active preset when Qjackctl was last closed. I notice that the application in KDE that enables the user to set which applications open automatically on StartUp also allows the user to select shell scripts.

Ive done some research, as a beginner, and Im led to believe I might need to use AWK and/or CHMOD. I could have a go at writing a shell script but Im always wary about experimenting with StartUp scripts/operations because obviously if I get it wrong and make my system unusable, then because its going to run first thing on each boot, Id have great difficulty disabling it.

View 3 Replies View Related

Programming :: Find / Write A Shell Script That Will Go Through A File Organized?

Jul 3, 2009

I am trying to find / write a shell script that will go through a file organized like this (but with thousands of lines)...

93,5.00,"contig00002",169,83,"jgi|Brafl1|100379|fgenesh2_pg.scaffold_359000019"
579,1.00,"contig00003",3,380,"jgi|Brafl1|114745|estExt_fgenesh2_pm.C_1200006"
450,5.00,"contig00007",2,352,"jgi|Brafl1|274326|estExt_GenewiseH_1.C_8420008"

...and check the region of each line between the second and third pipes (the 6-digit numbers) against the values in the first column of a separate text file in CSV format like this...

274326,"Wnt family of developmental regulators"
114745,"FOG: Hormone receptors"
100379,"Transcription factor tinman/NKX2-3, contains HOX domain"

...and when they match, replace the value to the right of the third pipe (e.g., fgenesh2_pg.sca...) with the value in the second column in the CSV file associated with that number.

View 4 Replies View Related

Server :: Write A Shell Script Which Will Check IP And Domain Name In Rbl?

Feb 12, 2011

i am trying to write a shell script which will check my IP and domain name in rbl and inform me if it is listed.

View 4 Replies View Related

Programming :: How To Write A Toy Shell

Mar 24, 2011

I'm trying to write a toy linux shell. For starters this is what I'm trying to do:

1. Start a new process with fork.

2. Execute a program in the new process with execl().

3. Redirect the output from the new process from STDOUT to another file descriptor, using dup2(2).

4. In the parent process, read the output from the child process and write it to the screen.

Creating a new process and executing a program in it is no problems, the problem is that I can't seem to capture the output from it in the parent process.

Code:

//digenv
//C++arl 2011-03-24
#include <stdio.h>
#include <sys/types.h>

[code]...

View 14 Replies View Related

Programming :: How To Write Own Shell In Unix

Sep 16, 2010

I wish to create my own shell for my operating systems project in college...

My professor has asked me to make sure that my shell can execute at least 30 or 40 commands... I have around a month's time

I have seen endless source codes in the net, I'm not able to understand any of it

How do i get about doing it?

View 2 Replies View Related

Programming :: Write A Function In A Shell Script?

Sep 22, 2010

I need a help regarding writing a function in a shell, what exactly a function does!!

View 3 Replies View Related

Programming :: Check If Directory Exists Using Shell Script

Apr 20, 2009

I am trying to write some small script file that will check if a USB stick is connected to my pc or not. I can't seem to get it to work, but I am sure it is a very simple fix.

I am running on Fedora core 10.Can anyone help me figure out what the problem is?If I run these lines through console it works fine (meaning, I type the commands in this file straight in the command line/console).

View 9 Replies View Related

Programming :: Possible To Check Which Window Has Focus Using Shell Script

Nov 7, 2009

I'm playing a game through wine (fullscreen), when I alt-tab back to my ubuntu desktop, the resolution doesn't change back, but stays at the game resolution.I'm currently using a shellscript that changes the resolution back to my origional resolution (using xrandr -s 0)

Is it possible to check which window has focus using a shellscript.If the game doesn't have focus change resolution to my origional resolution.

View 3 Replies View Related

Programming :: Write Shell Script To Ssh Into A Remote Computer And Run That?

Jun 26, 2010

How do i write a shell script to ssh into a remote server with password and run a script in it?

View 2 Replies View Related

Programming :: Write A Shell Script To Set Security Policies?

Apr 13, 2011

I don't know how to write a shell script to set security policies for Linux to start. and how. I know that there are many security policies for Linux but do not know which one best suited to write a shell script.

View 5 Replies View Related

Programming :: Write Shell Script So That It Can Run As Service / Daemon

Mar 8, 2010

Am not sure of the best way to go about writing a script. All I need at the moment is to start a java http server program at startup.How should I write languagetool.sh so as to be able to stop the script execution?

View 10 Replies View Related

Fedora :: Write A Shell Script That Will Look At Each File?

Jul 23, 2010

I have a number of text files throughout my /home/pjs/Documents directory tree that have execute permissions set. Almost all of my file names have spaces in them. I am trying to write a shell script that will look at each file in my Documents directory, find the ones that have execute permissions set, and run the command chmod 644. Of course, I don't want the command run on the directories.

The following script *doesn't work*, but might serve to illustrate what I am trying to do:

#!/bin/bash
for x in "$(ls -R)" do
if [ -f "$x" ] && [ -x $x ]; then
chmod 644 "$x"
fi
done

I want each file and directory name to be placed, one by one, in the variable $x, and then tested with the "if" conditionals.

The first problem seems to be that, although the command "ls -R" does produce a complete list of the files and directories I need, they are not placed, one by one, in the variable x like I want them to be.

Also, I think I should use the shift command so that the option -R doesn't get included as one of the values of the variable $x, but I can't figure out where to put it.

View 14 Replies View Related

Programming :: Write A Replacement For Shell Command Line Interpreter?

Sep 2, 2010

If say, I want to read the input given by user at the command prompt and write a code to execute the cmd given then which commands do i use to implement this ( Im writing the code in C )?

View 8 Replies View Related

Programming :: Shell Script To Check Whether Directory Exists On Remote Server

Jan 17, 2011

I am new to scripting, would like to have a script that tests whether a directory exists on remote host & display the message accordingly. The remote hostname can be provided by means of file containing list of hostnames. Can use rsh for connecting to remote host.I tried with couple of scripts by searching google but didn't get desired result. Please help me, below is my efforts, $file contains list of hostnames.

View 10 Replies View Related

Programming :: Made A Shell Script To Copy And Delete Files Through FTP?

Feb 13, 2011

I have made a shell script to copy and delete files through FTP.I want to first delete all txt files and then mput all txt files.

Code:
ftp ()
{

[code]....

View 6 Replies View Related

Programming :: Write A Shell Script For Submitting Multiple Jobs Sequentially

May 27, 2010

I want to write a shell script for submitting multiple jobs sequentially. For example,

#!/bin/bash
qsub job1.sh

# when job1.sh is done, run the next one

qsub job2.sh

how to make the shell script know that job1.sh is done and now I can run job2.sh?

View 4 Replies View Related

OpenSUSE Network :: Copy Files - Error Saying: Could Not Write To File Smb://{path_to_my_file_in_the_remote_folder}

Nov 8, 2010

I have installed opensuse 11.3 64 bit. For many years was able to connect to a file server within our domain via konqueror in all previous versions of opensuse using: smb://user@server.ip.adress/userdata/user_name/
This would ask me a password and then I would be able to move, read, create and delete files. I never configured samba on the linux client because this method always worked. However very recently (I suspect since I installed 11.3) I am facing a problem I cannot resolve. I can still log in, browse the remote folder, read files, create new ones (for example a txt file), delete them, but I cannot copy into that remote folder files larger than about 20KB (I try copying or moving files by dragging them from my desktop into the konqueror window that shows the remote folder contents).

Small files are OK, but for files are larger than ~20KB there is an error saying: Could not write to file smb://{path_to_my_file_in_the_remote_folder}. Strangely, the file is nevertheless created in the remote folder, but with a fixed length size of 32KiB.

View 2 Replies View Related

Programming :: Shell Script To Copy Database Archivelogs Sequentially From One Directory To Another?

Jun 2, 2009

want to write a shell script to copy database archivelog files sequential from one directory to another directory within a server. I am hereby enclosing the sample archivelog file name. Archive log filename : log_0000118432_1.arc (Here number 0000118432 will be sequentially incremented by 1 for next filename). Here the catch is all Archivelogs must be copied to destination directory. Previously copied files should not be copied.

View 3 Replies View Related

Programming :: Shell Script To Copy Newly Changed Files With Rsync?

Apr 20, 2010

I've got quite a decent rsync script setup, however I'd like to invoke it whenever there's change to a file. My initial idea was to use find, however this has two major flaws - the first being my particular unix veriant cant understand -print0 which means this doesn't work, the second is that I'm not 100% sure how to put variables into quotation marks so ls can understand the target:

Code:

for i in `find /shares/ -mtime -1 -print`; do ls -ltr $i;done

View 14 Replies View Related

General :: Write Expdp Output In A Text File Using A Shell Script ?

Feb 7, 2011

I want to write expdp output in a text file using a shell script

If i write like below:

It will write whatever is there in log file to text file

But, sometimes export fails with out start taking export (without generating log file) because of job already exists error. such times, we dont know about that error until we check manually... so i wrote like below:

But still it is not writing anything in to text file using above stmt...

View 1 Replies View Related

Ubuntu Servers :: Write A Shell Script In Order To Automate The Process Of Uploading A File?

May 21, 2010

I am trying to write a shell script in order to automate the process of uploading a file onto an FTP server using the built in FTP commands in ubuntu server (lucid). In order to connect I can use the following:

Code:

ftp wsbeorchids.org.uk
Name (wsbeorchids.org.uk:danielgroves): USERNAME
Password: PASSWORD

In need to pass my username and password in when prompted the prompts. How should I go about doing this? I have tried echoing the values without success. Please not that I am something of an amateur with scripting.

View 6 Replies View Related

General :: Write Shell Script That Takes A File Path As Command-line Arguments?

Dec 14, 2010

How can i write a shell script that takes a file path as command-line arguments.and it should report whether the path denotes a file or a directory.

View 2 Replies View Related

General :: Write A Shell Script Which Will Simultaneously Collect OS User Information And Write In An Individual Text Files?

Feb 17, 2010

I want to write a shell script which will simultaneously collect OS user information and write in an individual text files.Can anyone tell me the syntax of the script.N.B. The user name will be mentioned in an array within the shell script.

View 8 Replies View Related

Programming :: Script To Copy Paste Text From One File To Another (overwriting Part Of The File)?

Apr 19, 2011

I have a .txt-file with ~50.000 lines of numbers, generated by a mathematics program. From this file, I need line ~ 1.100 to line ~16.000 (these lines are always the same btw, this may make the solution easier, dunno) to be copy/pasted to another file, where the lines ~500 to ~15.000 (also, every time the same) should be overwritten by the aforementioned lines...I haven't found or come up with anything that works yet, mostly I find solutions to copy everything from one file to another but I can't find something to specifically overwrite a part of a file with part of another.

View 4 Replies View Related

Programming :: Write Shell Script That Adds An Extension ".new" To All The Files In A Direct?

May 28, 2010

How to Write a small shell script that adds an extension ".new" to all the files in a directory.

View 2 Replies View Related

Programming :: Parsing Xml File Using Shell Script And Generate Report In A PDF File?

Jul 9, 2009

parsing xml file using shell script and generate report in a PDF file

Xml file input:

<report>
<student name="x" father name="x1" class="first" Address="xyz">
<property name="sports" value="yes"/>
<property name="drawing" value="no"/>

[code]....

View 12 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved