General :: Create A Shell Script To Move Only Files Which Has Stopped Growing?
Jul 20, 2009
An external service I dont manage pushes mediafiles into a shared directory on my server. I need to move these files into their correct directories automatically. The problem is that if I run my script as a cronjob once every 3 minutes, I notice that the script copies files which are still on their way into my server. So I need to figure out how to have the script check that the files are complete (done downloading) before the script moves the files. This is what I got so far:
Code:
#!/bin/sh
# Script by proximity 280709.
# Locate correct directory
1. Every Sunday2. Find all files older than 1 day3. Gzip these file4. Tar up the gzipped files into one tar file.5. Name the tarball with a date stamp indicating what day it was created, so we know that week's files are in the file
I was wondering if it is possible to create a growing image for a loopback device. Like a file that you create that will grow with the data that is placed on it instead of a file that has to be the size of the entire file system?
I have a shell script that need to create some files:
1) backup files of user passed in file ( that will be written by this shell ).
2) temp files that the shell will create and later delete/remove.
This shell script will be used from my local dir ( I am not a super or a sysadmin ). Users of this shell will call this script to run on their local files in their respective directories. When my script runs, it errors with the following:
for the temp I was able to avoid this error by creating the temp file in the /tmp directory. All I want is for this shell script to run, create/modify/backup files in user's local dirs.
I am trying to clean my computer. Basically I try to order some movies to put all of them in directories. I started by hand but I am loosing time I guess. I want to do something like:
mv *.avi /nonexisting_directory/
nonexisting_directory being the name of the file without .avi, changing for each file. How can I write in command lineor in script?
I'm running out of disk space in root, so I decide to move /usr/lib64 directory to other partition by creating moving the whole directory to new location and create a softlink in the old location. What I'm planning to do is:
1. Copy the whole directory to new location
2. Make sure if there's no problem in the copy process
3. Create a softlink in the old location pointing to the new location.
However, when I'm comparing the old location and the new location using du command, there's some discrepancies between those two where the new location contain bigger size than the old one. How is this possible?
Is this the proper way to save disk space by creating a softlink?
This is Kishore and i am new to Ubuntu and SVN and please some one help me in creating a cron job for my svn backup every day at 10:30 pm I already created a cron job which looks like 30 10 * * * svnadmin dump /home/administrator/svnrepository >svn1 when i run command directly i am getting whole backup and it's size is 3.6 gb but when i run through cron job the backup size is only 9 mb. So finally my requests are 1. cron job for taking complete svn backup at 10:30 pm daily and 2. cron job to copy the SVN backup in to my windows system in d drive and this must be run every day at 11:30 pm.
Being relatively new both to Linux and this forum, i am sorry if i make a post that already is, evn though i couldn`t find it.My problem is i can`t move downloaded files over to root filesystem, i have downloaded and unpacked them to files. to change it`s looks and downloaded a skin, i open root, go to usr---> amsn ---> share --> skins, now i am to copy the file of the skin over to the root directory, butI also tried alt+f2, writing sudo conqueror, as an advice i got, but there was noe difference.
what I got - from a crontab run a script (understand that part), this script needs to count the amount of files in /outgoing/, then take 30 less that number, and move that many files from /readycalls/. I need to keep the asterisk outgoing que full of .call files with out having to many in there at any given time.
I am trying to create a shell script similar to ls, but which only lists directories. I have the first half working (no argument version), but trying to make it accept an argument, I am failing. My logic is sound I think, but I'm missing something on the syntax.
Code: if [ $# -eq 0 ] ; then d=`pwd` for i in * ; do if test -d $d/$i ; then echo "$i:" code....
I am a complete newbie to linux. I am currently taking a course at Devry university called netw240. I am in my 2nd week of class and am required to turn in a paper at the end of the coures were I write an automated shell script. I am currently using Fedora 12 on a Vmware player and want to try to write a script that automates the process of Logging user login activity to detect unauthorized remote access attempts.I am looking for pointers on were to start, examples, ect.. anything that can get me started. Also, is this type of script to much for a beginner?
I have a directory with a bunch of scripts and other random files. I want to move the files with the executable flag set to another folder en masse (or, if it's easier, the ones without the x flag). Is there an easy way?
In my bash script I need to move files in a folder if it is not in use.
Code: for entry in `ls /root/shared_storage/input`; do echo $entry run=`lsof /root/shared_storage/input/$entry` ru=${run:0:5} echo $entry if [ "$ru" == "" ]; then ........ It worked fine sometimes but sometimes it just get stuck at lsof. Is there any other way that I can use here to check if the $entry is using some other process?
how can I create a shell script for ssh where I don't have to type the password manually?I have learned expect command and I have tried multiple examples, but it didn't work.
I am using Linux on my system. I don't have gui for my system, only console is there.
I have some task to create a menu box window using dialog in shell scripting.
I have to take input from user & save it in a file.
But this should like html form as e.g.
Name - ..................... email id - .................. phone - ...................... location - ...................
Submit Cancel
Such window should be displayed on console using dialog & then user will enter his information there as Name,email id, phone,etc & submit it, then it gets saved to a file. Here submit & cancle are buttons. I have to do it in bash shell scripting. Or give me some examples like the above with shell script code.
I was trying to create a shell script which will automatically login to the server 192.168.1.7 and checks if a user exists there or not, if it doesn't exist then it should create the user.I have very little idea about shell scriptThis is what I tried:Quote:
#!/bin/bash pass="sacharje" ssh 192.168.1.7
Now, how to pass that password automatically to the ssh when it asks for the password? (I can't use public key authentication here)
I am new to Linux, but was put in charge of our company's Amazon presence. My problem is that all of the sudden, a shell script we have been using has stopped working, and returned an odd error that I simply can't decipher. The shell script is pretty simple, and is run on our crontab (however manually running it causes the same error as well). The script name is "sendh.sh" and to run it in Linux is simply typing "sh sendh.sh". Here it is:
[Code]....
Yes, obviously those files are in the directory, I can see them through the "ls" command (or through WinSCP as well). When run one by one, each command works fine, it's just when using this "sendh.sh" shell script then it fails. Does anyone know why "" is appended to the filenames when I try to run it, or what the heck "ambiguous redirect" means?
I have a php script in cron directory that generates 5 textfiles, after the files are generated, I want to create a script that will move the 5 text fiels to anoher folder name "web".
So I was wondering, if I capture this output into a file (ie. one file per line), can anyone help me write a command which iterates through the file and moves the files one by one to a specified directory?
I have this script that I use to find log files in the /var/log directory that are 2 days old, move them to /var/log/tmp, rename them to the system date.filename and move them back to /var/log. Everything seems to work as planned, except that the files don't get moved out of temp, and they keep getting rename. This leads to very long filenames such as:
What is it about this script that isn't moving it back to /var/log? Also, is there a better way of doing this than what I'm doing? Basically, I'm just trying to set up an audit trail on some of the files in /var/log, so that at the end of the month I can tar them, and then have our syslog server pick up the one giant monthly log.
I have Ubuntu 10.l0 installed on my laptop. I recently install the KDE desktop from the Software Center. Today, I noticed something strange. I tried to move a file to the trash when I got this error message: "The trash has reached its maximum size! Cleanup the trash manually." I don't have any files in the trash. I went back to Gnome, and was able to delete the file. I opened up Dolphin while still in Gnome, and couldn't delete anything, so I know that this isn't a KDE problem
I use avg free as antivirus scanner. I looked some time for a scanner to scan and remove viruses. Problem is avg 8.5 will only detect viruses, not remove them...I use a oneliner looking like this:
I have to move files between two file systems /inst and /inst2.When I perform 'cp -a /inst /inst2' it copies everything even hidden files and preserves access permissions.But when I perform 'mv /inst /inst2' it also preserves access perms and moves everything besides hidden files.Questions :hy is so ?What tool to use when moving file systems from one fs to another (rsync) ?
I am new to Linux. I am using tar to backup my emails to a server. I would like to automate this process to routinely backup my emails periodicly, however, i keep running into a problem: I start in the dir I would like to create the tar file (dir size = 240MB). I enter the following command
tar cf bup.mail.llc.tar "/Users/d/Library/Mail/INBOX.mbox/Messages" file size = 234MB
When I would like to backup my emails into the previously created tar file I use the following command:
tar uf bup.mail.llc.tar "/Users/d/Library/Mail/INBOX.mbox/Messages"file size = 462MB The backup command works, except the size of the original tar file grows, around twice the size. When I extract the updated tar file (file size = 462MB), the unarchived file is 240MB the same size as the original directory.
Why does the size of the tar keep growing each time i perform 'tar uf'?? I don't understand this
the system currently have a directory with all the invalid files. how bad is it to move a single file to a directory containing 3 million files already?