Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Script to check if files exits Post 303002140 by scriptor on Friday 18th of August 2017 08:15:08 AM
Old 08-18-2017
thx rudic fro your suggestion but it live system and not allowed to make such changes.
for problem fix team is working.

i would really appreciate i get help in moving the file to other location.
which i am trying but getting error .
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script exits with $? not 0 randomly, how can I see what command failed?

Hi! I have this situation with 3 shellscripts. One is a "startscript" that simply calls other scripts. This one is scheduled with cron to run at regular intervals. That script runs what I'll refer to as Script 1. Script 1 in turn runs script 2 (import_catalogs_buyer.sh) Sometimes, seemingly... (2 Replies)
Discussion started by: trailsmoke
2 Replies

2. Shell Programming and Scripting

perl script to check if empty files are created and delete them and run a shell script

I have a local linux machine in which the files are dumped by a remote ubuntu server. If the process in remote server has any problem then empty files are created in local machine. Is there any way using perl script to check if the empty files are being created and delete them and then run a shell... (2 Replies)
Discussion started by: hussa1n
2 Replies

3. Shell Programming and Scripting

Exits from putty instead of shell script

Dear, I have written below code to initiate the log at top of my script. #Set the log file LOGFILE=<path>/<filename.log> exec > $LOGFILE 2>&1 ............... .... ... .. ............ echo -e "\n\n Script finished OK " `date "+%m/%d/%y %H:%M:%S" ` "\n\n" exit 0 the logging ends only... (14 Replies)
Discussion started by: Imran_Chennai
14 Replies

4. Shell Programming and Scripting

'script' command exits immediately

I'm trying to capture the output of some commands with the 'script' utility. Normally, I would type 'script /path/to/output/file', then enter commands, then hit ctrl+D to end the 'script' capture. I'm having trouble with it on a server. Upon starting 'script', it exits immediately before I type... (6 Replies)
Discussion started by: jalburger
6 Replies

5. Shell Programming and Scripting

need a shell script to extract the files from source file and check whether those files existonserve

Hi, I am new to shell scripting.Please help me on this.I am using solaris 10 OS and shell i am using is # echo $0 -sh My requirement is i have source file say makefile.I need to extract files with extensions (.c |.cxx |.h |.hxx |.sc) from the makefile.after doing so i need to check whether... (13 Replies)
Discussion started by: muraliinfy04
13 Replies

6. Shell Programming and Scripting

Check when user exits SUDO

Hello to everyone, I'm new here and would like to thank everybody for the upcoming support, I know that I will have my question answered here, this community is huge. :) First of all, I´m a DBA and work on a daily basis on Unix environments of all kinds (HP-UX, Solaris, AIX, etc). I have... (8 Replies)
Discussion started by: ZeroBR
8 Replies

7. UNIX for Dummies Questions & Answers

Script dosent exits after executing the script

Hi i wrote a script which dosent exists after executing any help #!/bin/bash netstat -ptlen | grep 10000 if ; then echo "Hive Thrift server is running" exit 0 else echo "Hive Thrift server is down Trying to Bring up the service" | mail -s "ALERT" team@domain.com `nohup hive... (7 Replies)
Discussion started by: vikatakavi
7 Replies

8. Shell Programming and Scripting

Ssh bash script exits without remote command completion

Hi, My goal is to connect from unix server A to windows server B and call a bat file on windows. I am able to succeed in remoting to windows and executing a command, the issue i am facing is the shell scrip is exiting without making sure of bat file success. Can you please help me in... (4 Replies)
Discussion started by: pxp018
4 Replies

9. Shell Programming and Scripting

Script exits when using UNIX2dos / dos2UNIX

I'm not sure why but my script quits automatically at the point where unix2dos / dos2unix command is used. :confused::confused::confused: How do a fix it? LOG_FILE=MADDY.txt unix2dos ${LOG_FILE} exec 2> $LOG_FILE 1>&2 echo ${LOG_FILE} The script exists after the below... (3 Replies)
Discussion started by: machomaddy
3 Replies

10. UNIX for Beginners Questions & Answers

Bash script to compare file all the files exits or not

Currently i am building a script like based on region parameter it will filter the records in config file and then it will create a text file like ab.txt and it will read the path location in that file and now i need to compare the files name in the config file to files in the path of the config... (1 Reply)
Discussion started by: saranath
1 Replies
RENAME(2)						     Linux Programmer's Manual							 RENAME(2)

NAME
rename - change the name or location of a file SYNOPSIS
#include <stdio.h> int rename(const char *oldpath, const char *newpath); DESCRIPTION
rename renames a file, moving it between directories if required. Any other hard links to the file (as created using link(2)) are unaffected. If newpath already exists it will be atomically replaced (subject to a few conditions - see ERRORS below), so that there is no point at which another process attempting to access newpath will find it missing. If newpath exists but the operation fails for some reason rename guarantees to leave an instance of newpath in place. However, when overwriting there will probably be a window in which both oldpath and newpath refer to the file being renamed. If oldpath refers to a symbolic link the link is renamed; if newpath refers to a symbolic link the link will be overwritten. RETURN VALUE
On success, zero is returned. On error, -1 is returned, and errno is set appropriately. ERRORS
EISDIR newpath is an existing directory, but oldpath is not a directory. EXDEV oldpath and newpath are not on the same filesystem. ENOTEMPTY or EEXIST newpath is a non-empty directory, i.e., contains entries other than "." and "..". EBUSY The rename fails because oldpath or newpath is a directory that is in use by some process (perhaps as current working directory, or as root directory, or because it was open for reading) or is in use by the system (for example as mount point), while the system considers this an error. (Note that there is no requirement to return EBUSY in such cases - there is nothing wrong with doing the rename anyway - but it is allowed to return EBUSY if the system cannot otherwise handle such situations.) EINVAL The new pathname contained a path prefix of the old, or, more generally, an attempt was made to make a directory a subdirectory of itself. EMLINK oldpath already has the maximum number of links to it, or it was a directory and the directory containing newpath has the maximum number of links. ENOTDIR A component used as a directory in oldpath or newpath is not, in fact, a directory. Or, oldpath is a directory, and newpath exists but is not a directory. EFAULT oldpath or newpath points outside your accessible address space. EACCES Write access to the directory containing oldpath or newpath is not allowed for the process's effective uid, or one of the directo- ries in oldpath or newpath did not allow search (execute) permission, or oldpath was a directory and did not allow write permission (needed to update the .. entry). EPERM or EACCES The directory containing oldpath has the sticky bit set and the process's effective uid is neither that of root nor the uid of the file to be deleted nor that of the directory containing it, or newpath is an existing file and the directory containing it has the sticky bit set and the process's effective uid is neither that of root nor the uid of the file to be replaced nor that of the direc- tory containing it, or the filesystem containing pathname does not support renaming of the type requested. ENAMETOOLONG oldpath or newpath was too long. ENOENT A directory component in oldpath or newpath does not exist or is a dangling symbolic link. ENOMEM Insufficient kernel memory was available. EROFS The file is on a read-only filesystem. ELOOP Too many symbolic links were encountered in resolving oldpath or newpath. ENOSPC The device containing the file has no room for the new directory entry. CONFORMING TO
POSIX, 4.3BSD, ANSI C BUGS
On NFS filesystems, you can not assume that if the operation failed the file was not renamed. If the server does the rename operation and then crashes, the retransmitted RPC which will be processed when the server is up again causes a failure. The application is expected to deal with this. See link(2) for a similar problem. SEE ALSO
link(2), unlink(2), symlink(2), mv(1) Linux 2.0 1998-06-04 RENAME(2)
All times are GMT -4. The time now is 05:40 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy