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
File(3pm)						User Contributed Perl Documentation						 File(3pm)

NAME
Proc::PID::File - a module to manage process id files SYNOPSIS
use Proc::PID::File; die "Already running!" if Proc::PID::File->running(); Process that spawn child processes may want to protect each separately by using multiple pidfiles. my $child1 = Proc::PID::File->new(name => "lock.1"); my $child2 = Proc::PID::File->new(name => "lock.2"); which may be checked like this: <do-something> if $child1->alive(); and should be released manually: $child1->release(); DESCRIPTION
This Perl module is useful for writers of daemons and other processes that need to tell whether they are already running, in order to prevent multiple process instances. The module accomplishes this via *nix-style pidfiles, which are files that store a process identifier. The module provides two interfaces: 1) a simple call, and 2) an object-oriented interface Simple Interface The simple interface consists of a call as indicated in the first example of the Synopsis section above. This approach avoids causing race conditions whereby one instance of a daemon could read the pidfile after a previous instance has read it but before it has had a chance to write to it. running [hash[-ref]] The parameter signature for this function is identical to that of the ->new() method described below in the OO Interface section of this document. The method's return value is the same as that of ->alive(). OO Interface The following methods are provided: new [hash[-ref]] This method is used to create an instance object. It automatically calls the ->file() method described below and receives the same paramters. For a listing of valid keys in this hash please refer to the aforementioned method documentation below. In addition to the above, the following constitute valid keys: verify = 1 | string This parameter implements the second solution outlined in the WARNING section of this document and is used to verify that an existing pidfile correctly represents a live process other than the current. If set to a string, it will be interpreted as a regular expression and used to search within the name of the running process. Alternatively, a 1 may be passed: For Linux/FreeBSD, this indicates that the value of $0 will be used (stripped of its full path); for Cygwin, $^X (stripped of path and extension) will be used. If the parameter is not passed, no verification will take place. Please note that verification will only work for the operating systems listed below and that the OS will be auto-sensed. See also DEPENDENCIES section below. Supported platforms: Linux, FreeBSD, Cygwin debug Any non-zero value turns debugging output on. Additionally, if a string is passed containing the character M, the module name will be prefixed to the debugging output. file [hash[-ref]] Use this method to set the path of the pidfile. The method receives an optional hash (or hash reference) with the keys listed below, from which it makes a path of the format: $dir/$name.pid. dir Specifies the directory to place the pid file. If left unspecified, defaults to /var/run. name Indicates the name of the current process. When not specified, defaults to basename($0). alive Returns true when the process is already running. Please note that this call must be made *after* daemonisation i.e. subsequent to the call to fork(). If the verify flag was set during the instance creation, the process id is verified, alternatively the flag may be passed directly to this method. touch Causes for the current process id to be written to the pidfile. release This method is used to delete the pidfile and is automatically called by DESTROY method. It should thus be unnecessary to call it directly. locktime [hash[-ref]] This method returns the mtime of the pidfile. AUTHOR
Erick Calder <ecalder@cpan.org> ACKNOWLEDGEMENTS
1k thx to Steven Haryanto <steven@haryan.to> whose package (Proc::RID_File) inspired this implementation. Our gratitude also to Alan Ferrency <alan@pair.com> for fingering the boot-up problem and suggesting possible solutions. DEPENDENCIES
For Linux, FreeBSD and Cygwin, support of the verify option requires availability of the ps utility. For Linux/FreeBSD This is typically found in the procps package. Cygwin users need to run version 1.5.20 or later for this to work. WARNING
This module may prevent daemons from starting at system boot time. The problem occurs because the process id written to the pidfile by an instance of the daemon may coincidentally be reused by another process after a system restart, thus making the daemon think it's already running. Some ideas on how to fix this problem are catalogued below, but unfortunately, no platform-independent solutions have yet been gleaned. - leaving the pidfile open for the duration of the daemon's life - checking a "ps" to make sure the pid is what one expects (current implementation) - looking at /proc/$PID/stat for a process name - check mtime of the pidfile versus uptime; don't trust old pidfiles - try to get the script to nuke its pidfile when it exits (this is vulnerable to hardware resets and hard reboots) - try to nuke the pidfile at boot time before the script runs; this solution suffers from a race condition wherein two instances read the pidfile before one manages to lock it, thus allowing two instances to run simultaneously. SUPPORT
For help and thank you notes, e-mail the author directly. To report a bug, submit a patch or add to our wishlist please visit the CPAN bug manager at: http://rt.cpan.org AVAILABILITY
The latest version of the tarball, RPM and SRPM may always be found at: http://perl.arix.com/ Additionally the module is available from CPAN. LICENCE
This utility is free and distributed under GPL, the Gnu Public License. A copy of this license was included in a file called LICENSE. If for some reason, this file was not included, please see http://www.gnu.org/licenses/ to obtain a copy of this license. $Id: File.pm,v 1.16 2004-04-08 02:27:25 ekkis Exp $ perl v5.10.0 2010-04-25 File(3pm)
All times are GMT -4. The time now is 11:30 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy