Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Moving file using shell script fails occasionally Post 303046053 by Sac on Wednesday 22nd of April 2020 12:35:41 PM
Old 04-22-2020
Hi Sea, Thanks for the response.
Below is the corrected code, and have enabled the debug mode as well.

As observed, when i run the script manually all the files are copied and moved properly, but when i add the script to cronjob, am getting file count mismatch.

Ex: If 1000 files got copied in one day then only 950/960 are moved.

Code:
cd / 

rm script.source.file
set -x
SOURCEONEACTUAL="a"
SOURCEONENEW="b"

ls -lrth $SOURCEONEACTUAL | awk '{print $9}' |grep -v temp > script.source.file

while read line
do
cd  $SOURCEONEACTUAL
cp $line $SOURCEONEACTUAL/temp/
mv $line $SOURCEONENEW

done < script.source.file

date
set +x

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

need shell script for moving file one by one

#SD=source dir TD= target dir SD="$/amddev/app01/manoj/new/scripts/old" TD="$/amddev/app01/manoj/new/scripts/new" EXT="$*.txt" for i in `ls -F "$SD"/*"$EXT"|grep -v /$` do mv "$SD" "$TD" if then echo "$i" successfully moved echo Manoj successfully..1 ( here i... (8 Replies)
Discussion started by: manojkarthi
8 Replies

2. Shell Programming and Scripting

why shell script fails

hi .. I have automate some process on unix through sehll script . but i don't know there is some problem in scripts, some time shell script works and some time it fails. so my query is that "Why shell script fails some times?" thanks (4 Replies)
Discussion started by: tahir23
4 Replies

3. Shell Programming and Scripting

why shell script fails?

hi , i m trying to run a shell script automatically , some time it works fine but some time it fails , what could be the problem . If anybody have an idea about this problem then reply . Thanks in advacne (4 Replies)
Discussion started by: tahir23
4 Replies

4. Shell Programming and Scripting

shell script for moving all the file from the same folder

Hi , I need a shell script which basicaly moves all the files from one folder say folder x to folder y and once they are moved to folder y a datetimestamp should be attached to there name for ex file a should be moved to y folder and renamed as a_20081015 (1 Reply)
Discussion started by: viv1
1 Replies

5. Shell Programming and Scripting

Shell Script for moving 3 days old file to Archive Folder

Hi Experts, I have a "Source" folder which may contain some files. I need a shell script which should move all files which are older than 3 days to "Archive" folder. Thanks in Advance... (4 Replies)
Discussion started by: phani333
4 Replies

6. Shell Programming and Scripting

Execute shell script even if the first script fails

All, I executing a perl script and shell script from a master shell script. i will execute the perl script first and have to execute the shell script after the completion of perl execution. Below is the code i use for it, script_root='/dev/scripts' /usr/bin/perl -S $script_root/test.pl;... (5 Replies)
Discussion started by: vel4ever
5 Replies

7. Shell Programming and Scripting

How to exit from shell script if above condition fails?

HI cd ${back_home} if above back_home does not exist, then script shoul exit. Please let us know how to do that (7 Replies)
Discussion started by: buzzme
7 Replies

8. Shell Programming and Scripting

Shell Script for renaming and moving Files - Easy?

Hey guys, ive been working on this for about 2hrs now - without any solution. At first I need to say I dont have skills in linux bash scripting, but I tried to use some codesnippets and manuals from google. What I want to do: I have different folders including 2 different filestypes with... (15 Replies)
Discussion started by: peter1337
15 Replies

9. UNIX for Beginners Questions & Answers

Linux shell | how to exit a script if any command fails.

Hi, i am new here let me say HI for all. now i have a question please: i am sending one command to my machine to create 3 names. if one of the names exists then the box return error message that already have the name but will continue to create the rests. How i can break the command and... (7 Replies)
Discussion started by: Amiri
7 Replies

10. Shell Programming and Scripting

Array declared in shell script works for AIX but fails in Linux

Array declared in shell script works for AiX 6.1 and above but fails in Linux CentOS 7. I have the below code for Array in my shell script that runs fine on AiX systems. Note: on AiX it uses ksh shell while on Linux it uses non ksh shell. set -A filelist However, i now wish to use the... (3 Replies)
Discussion started by: mohtashims
3 Replies
SQUEAK(1)																 SQUEAK(1)

NAME
squeak - Unix Squeak virtual machine launcher SYNOPSIS
squeak squeak [image filename] [project filename] DESCRIPTION
squeak is the virtual machine for the Squeak Smalltalk system. It requires three files to operate correctly: an image file containing a `snapshot' of a live Squeak session, a changes file containing the source code for modified methods in the image, and a copy of (or a link to) a shared system sources file containing the source code for methods that have not been modified since the last major version increment. The image and changes files contain the state of a user's Squeak session, which is persistent between consecutive sessions. Private copies of these files are therefore normally required. The squeak script checks that the local Squeak installation appears sane, and then copies the required files to the current working directory. If squeak encounters no problems, it will finish by running squeak vm to start a Squeak session using the newly copied image and changes files. INVOCATION
squeak accepts an optional image name, and/or an optional project name. If an image name is given on the command line then squeak tries to run that image. Otherwise squeak checks the environment variable SQUEAK_IMAGE and, if it is set, uses its value as the name of the image to run. Otherwise squeak looks for available images in the ~/squeak and /usr/share/squeak directories. Then, squeak shows a dialog with all the available images for the user to choose one of them. If the chosen image is at SQUEAK_IMAGE_DIR (which is by default /usr/share/squeak), it will be copied to ~/squeak. If only one image is available, no dialog will be shown and the script will run that image. The image argument can be followed by a project name. This is the name of a 'document' that should have been saved from a Squeak image. The project name must have the '.pr' extension. The project argument can also be providen without an image name. In that case, squeak will look for an image to run the project following the same criteria explained above. ENVIRONMENT
To know all the environment variables that can affect the squeak image launching, take a look at the Environment section of the squeakvm man page. Appart from those options, these are applied to this script: SQUEAK_IMAGE_DIR is the directory, together with ~/squeak where the launcher looks for Squeak images. (The default value is /usr/share/squeak) SQUEAK_IMAGE is the name of a image file to be run by the script. SQUEAK is the name of an alternative vm (or alternative vm options) to be run by the script. The script launches the vm with these default options: '-mmap 1024M -nomixer' NOTES
This manual page documents version [version] of Unix Squeak. It may not be appropriate for any other version. The image and changes files containing a saved Squeak session are intimately related. They should always be used together, never be sepa- rated, and under no circumstances should an image be run with a changes file that has been used with a different image. Failure to adhere to the above could cause the source code for the methods in the image to become garbled and impossible to retrieve. The Unix Squeak virtual machine fully supports OpenGL in both the X11 and Quartz display drivers. Open Croquet will run just fine with either of these drivers (and many Mac OS X users will even have the choice of which driver to use :). Because of licensing issues, a Squeak image or Squeak sources package is not available in Debian yet. So the user must download a proper image in order to get this script useful. Available images can be found in these web sites: The official Squeak home page: http://squeak.org The SqueakLand (international educational oriented) world: http://www.squeakland.org The spanish educative oriented Squeak page: http://squeak.educarex.es/ AUTHOR
This manual page was written by Jose L. Redrejo for the Debian project SEE ALSO
squeakvm(1). SQUEAK(1)
All times are GMT -4. The time now is 01:24 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy