Sponsored Content
Top Forums Shell Programming and Scripting Wait and continue if directory stays same size Post 302971792 by Don Cragun on Monday 25th of April 2016 06:46:51 PM
Old 04-25-2016
Please don't ask the same question in two threads! It is almost impossible for people trying to help you to follow one discussion being held in two places!

As I said in post #40 in the thread titled Script to tar/rsync/rm multiple folder names:
Quote:
The size of a directory tells you very little about whether or not files in that directory are growing, and (if any files have ever been removed from a directory) even if a new file is created in a directory, its size might not change.

It would be much better if you would create a hidden directory under /to_be_archived (such as /to_be_archived/.in_progress/project), move everything into that directory, and then after that project directory contains everything you want to archive, issue the command:
Code:
mv /to_be_archived/.in_progress/project /to_be_archived/project

which will be an atomic operation. Your existing script won't see the hidden directory so it won't see .in_progress/project until it is ready to process after it has been moved up.
This User Gave Thanks to Don Cragun For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

wait command - cat it wait for not-chile process?

Did not use 'wait' yet. How I understand by now the wait works only for child processes, started background. Is there any other way to watch completion of any, not related process (at least, a process, owned by the same user?) I need to start a background process, witch will be waiting... (2 Replies)
Discussion started by: alex_5161
2 Replies

2. UNIX for Dummies Questions & Answers

detect file size then quit or continue

Hi Guys, I'm running a cron that mails me a file every night. The file is based on form input from the web and each evening after I mail it I delete and start a new file by the same name. It's a csv file so I preload a line of headers into the file. So far, so good. On days when no one inputs... (5 Replies)
Discussion started by: steven99
5 Replies

3. Solaris

Directory size larger than file system size?

Hi, We currently have an Oracle database running and it is creating lots of processes in the /proc directory that are 1000M in size. The size of the /proc directory is now reading 26T. How can this be if the root file system is only 13GB? I have seen this before we an Oracle temp file... (6 Replies)
Discussion started by: sparcman
6 Replies

4. UNIX for Dummies Questions & Answers

directory tree with directory size

find . -type d -print 2>/dev/null|awk '!/\.$/ {for (i=1;i<NF;i++){d=length($i);if ( d < 5 && i != 1 )d=5;printf("%"d"s","|")}print "---"$NF}' FS='/' Can someone explain how this works..?? How can i add directory size to be listed in the above command's output..?? (1 Reply)
Discussion started by: vikram3.r
1 Replies

5. Shell Programming and Scripting

Shell script: If a file stays in a particular directory more than 30 min send an email

Hi , I am new to shell scripting. i have a requirement say i will receive a file in a directory say /xyz.if that file stays in that directory more than 30 min i need to get a mail to my outlook.this should run for every 20 min in crontab. can anyone help me? (8 Replies)
Discussion started by: muraliinfy04
8 Replies

6. Shell Programming and Scripting

Line in bash script to wait for x feedbacks and then continue

I have a script that runs a console/terminal command on the server and what is want is for each of the multiple success reports fed back from the clients (echo-ed out onto the conosle) to be counted and after x number of reports reboot the server. The Details: The command (program) is... (0 Replies)
Discussion started by: dp123
0 Replies

7. Shell Programming and Scripting

while [[ $# -gt 0 ]] stays in the loop

Hi, I have(ksh): ... while ] do fullPath=$(grep -s '/' $1 | wc -l) echo $fullPath if ]; then fi echo "Wrong, full path" shift done ... I tried to do: (5 Replies)
Discussion started by: chish
5 Replies

8. Shell Programming and Scripting

How to delete some of the files in the directory, if the directory size limits the specified size

To find the whole size of a particular directory i use "du -sk /dirname".. but after finding the direcory's size how do i make conditions like if the size of the dir is more than 1 GB i hav to delete some of the files inside the dir (0 Replies)
Discussion started by: shaal89
0 Replies

9. UNIX for Dummies Questions & Answers

Ls directory size reporting byte size instead of file count

I have been searching both on Unix.com and Google and have not been able to find the answer to my question. I think it is partly because I can't come up with the right search terms. Recently, my virtual server switched storage devices and I think the problem may be related to that change.... (2 Replies)
Discussion started by: jmgibby
2 Replies

10. UNIX for Beginners Questions & Answers

If file pattern exists in directory then continue

he below looks in $dir for any pattern of fileone. As is, it executes but only returns File found if the exact format in the script exsists. Why isn't a pattern of fileone being looked for and if it is in $dir, File found. I think that is what should happen. Thank you :). dir=/path/to if... (5 Replies)
Discussion started by: cmccabe
5 Replies
su(1)							      General Commands Manual							     su(1)

NAME
su - Substitutes user ID temporarily SYNOPSIS
su [- | -f] [user] [shell_option] [shell_command] OPTIONS
Prevents the user's shell initialization file from being executed by passing the -f option to the user's shell, thus making su start up faster. The -f option is supported by the csh family of shells. Simulates a full login by executing the commands in either the and files for csh or the file for sh and ksh and by setting the current working directory to the user's home directory. Passes the specified shell option flag to the newly invoked user's shell for execution. The shell_option must be supported by the invoked shell. The csh, sh, ksh, and any other interactive command shell support the commonly used -c shell option. By default (no "shell_option"), the shell is opened with the -i (interactive) shell option. See the reference page for the shell you are using for more information on the shell options. Passes the specified command to the newly invoked user's shell for execution. The shell_command must be supported by the invoked shell. DESCRIPTION
The su command demands the password of the specified user, and if it is given, changes to that user and invokes the user's shell without changing the current directory. Except in a case where the - option is used, the user environment is unchanged except for HOME, SHELL, USER, and LOGNAME which are taken from the password file for the user being substituted (see environ). The new user ID stays in force until the shell exits. If no user is specified, root is assumed. Only users who belong to group number 0 (system) can issue su to become root, even with the root password. To remind superusers of their responsibilities, the shell substitutes a # (number sign) for its usual prompt. Shell commands may be passed to the shell that is spawned by su by including them on the command line after the su flags and arguments. After the flags recognized by su and the user argument are processed, unrecognized command line flags (shell_options) and/or arguments (shell_commands) are passed to the shell for execution. If the spawned shell does not support the command or the format of the command, the command is not executed and the resulting shell behavior and error messages are determined by the shell. Security Restrictions The su command fails if any lock conditions exist on the target account. Specifically, if the destination account was retired, if the num- ber of unsuccessful login attempts exceeds the maximum allowed, if the administrative lock was applied, or the password's lifetime was exceeded, the Information System Security Officer (ISSO) must unlock the destination account before any user can log in to it or use su to transition to it. SECURITY NOTE
This security-sensitive command uses SIA (Security Integration Architecture) as an interface to the security mechanism(s) that perform the actual user validation. See the matrix.conf(4) reference page for more information. ENVIRONMENT VARIABLES
The following environment variables affect the behavior of su: SEE ALSO
Commands: csh(1), ksh(1), sh(1) su(1)
All times are GMT -4. The time now is 10:35 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy