Sponsored Content
Top Forums Shell Programming and Scripting Alert for missing file in directory Post 302992174 by Don Cragun on Wednesday 22nd of February 2017 09:56:48 AM
Old 02-22-2017
I don't see any way to guess at what unspecified magic will translate:
Code:
Name in /scripts/data/file_list.ind	Actual name to use
===================================	==========================================================
file.txt				file_claim_(systemdate)_mly.dat
file2.txt				file_claim(systemdate)_mly.bz2
and so on				file_claimSomeStringMaybe(systemdate)_mly.AbsolutelyNoIdea
...					???

And, you have given us no indication of what format is used to display your systemdate... could it be: DayOfWeek, MonthName DayOfMonth, Year; YYYYMMDD; MM-DD-YYYY; or something very complicated like MM/DD/YYYY (which is a pathname, not a filename)? Of course, if you use the 1st form of systemdate above your (unneeded) awk script won't work. And, with parentheses in your file names (and, especially if you include <space>s in your file names), you absolutely have to quote all expansions of the variable(s) that contain those file names.

All of the uses of cat and awk in your script should be removed to make your script more efficient. And expansions of all of your variables should be quoted. But, without a clear definition of the mapping of the filenames in /scripts/data/file_list.ind to the filenames you need to process, there isn't much we can do to help you fix your code.

You haven't said what operating system or shell you're using. From your definition of the variable _ID, I would assume you're using a Solaris/SunOS system and that you are not using /bin/sh as your shell (since you're using the $(command) form of command substitution). If you're using a Solaris 10 system and ksh (which on Solaris 10 is a 1988 version of the Korn shell) as your shell, the variable substitutions suggested by Chubler_XL in post #2 won't work. Any time you post a shell script and ask for help modifying it, please tell us what operating system (including the version) and shell you're using so we can make suggestions that will work in your environment.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

If any file resides for more than an hour in this directory then to raise an alert

Hi If there is a file upload done from a remote server and if the file remains without being extracted for more than an hour, I need to identify the files and create an alert message to the users in the other end. please help me writing a shell script for it. Regards Yazhini (2 Replies)
Discussion started by: yazhini.t
2 Replies

2. Solaris

Missing Base Directory

Hey all, I'm attempting to migrate a zone from one system to another, but I noticed that on the new system ssl BASEDIR was missing. I was wondering if creating the directory path for this would fix the issue when I migrate files over. SSL is installed on the new system but does not show a... (1 Reply)
Discussion started by: em23
1 Replies

3. Shell Programming and Scripting

Script to send an alert if a file is present in a directory for 10 min

hi, A script which look into a directory and send an alert via a mail. If there is any file exisiting in a directory for more then 10 min. (5 Replies)
Discussion started by: madfox
5 Replies

4. UNIX for Advanced & Expert Users

Solved: Missing whatis file from my /usr/shar/lib directory...

My whatis file is missing from my /usr/share/lib directory. I know I can recreate it by using catman -w command. My question is, why do all of my other servers have it and this one doesn't. Maybe due to a recent move of old to new servers and it just wasn't copied over. Unlikely, 'cause all... (0 Replies)
Discussion started by: zixzix01
0 Replies

5. Shell Programming and Scripting

Help need to find out the missing files in the directory

Hi All, Below is my requirement. I want to display the missing files in the directory. Below is my example From SFTP we are copying 10 files every day. if any files missed on that day need to send a notification with missing files Test1.dat 20121107_00_file.csv 20121107_01_file.csv... (8 Replies)
Discussion started by: bbc17484
8 Replies

6. Red Hat

Directory missing

Hi, Archive backup log is /oracle_backup/logs . Since yesterday /logs directory is missing.How to find What has changed since the last time it has worked? OS -- Linux 2.6 x86_64 Regards, Maddy (4 Replies)
Discussion started by: Maddy123
4 Replies

7. UNIX for Dummies Questions & Answers

Directory missing .how to find the cause .

Hi, i am using rhel6.4, i lost my directory under /home .is there any way to find the reason how that directory deleted and how to recover deleted folder. (2 Replies)
Discussion started by: sayhirams
2 Replies

8. Shell Programming and Scripting

CLI script for emailing alert if files missing in dir

thread removed (4 Replies)
Discussion started by: billabongjimmy
4 Replies

9. Shell Programming and Scripting

Systemd errors of missing file “No such file or directory” inspite of file being present

The contents of my service file srvtemplate-data-i4-s1.conf is Description=test service for users After=network.target local-fs.target Type=forking RemainAfterExit=no PIDFile=/data/i4/srvt.pid LimitCORE=infinity EnvironmentFile=%I . . . WantedBy=multi-user.target (0 Replies)
Discussion started by: rupeshkp728
0 Replies

10. Shell Programming and Scripting

Bash to check directory and create missing folder from file

In the below bash I am trying to ensure that all folders (represented by $folders) in a given directory are created. In the file f1 the trimmed folder will be there somewhere (will be multiple trimmed folders). When that trimmed folder is found (represented by $S5) the the contents of $2 printed... (19 Replies)
Discussion started by: cmccabe
19 Replies
DH_INSTALLDEB(1)						     Debhelper							  DH_INSTALLDEB(1)

NAME
dh_installdeb - install files into the DEBIAN directory SYNOPSIS
dh_installdeb [debhelperoptions] DESCRIPTION
dh_installdeb is a debhelper program that is responsible for installing files into the DEBIAN directories in package build directories with the correct permissions. FILES
package.postinst package.preinst package.postrm package.prerm These maintainer scripts are installed into the DEBIAN directory. Inside the scripts, the token #DEBHELPER# is replaced with shell script snippets generated by other debhelper commands. package.triggers package.shlibs These control files are installed into the DEBIAN directory. Note that package.shlibs is only installed in compat level 9 and earlier. In compat 10, please use dh_makeshlibs(1). package.conffiles This control file will be installed into the DEBIAN directory. In v3 compatibility mode and higher, all files in the etc/ directory in a package will automatically be flagged as conffiles by this program, so there is no need to list them manually here. package.maintscript Lines in this file correspond to dpkg-maintscript-helper(1) commands and parameters. However, the "maint-script-parameters" should not be included as debhelper will add those automatically. Example: # Correct rm_conffile /etc/obsolete.conf 0.2~ foo # INCORRECT rm_conffile /etc/obsolete.conf 0.2~ foo -- "$@" In compat 10 or later, any shell metacharacters will be escaped, so arbitrary shell code cannot be inserted here. For example, a line such as "mv_conffile /etc/oldconffile /etc/newconffile" will insert maintainer script snippets into all maintainer scripts sufficient to move that conffile. It was also the intention to escape shell metacharacters in previous compat levels. However, it did not work properly and as such it was possible to embed arbitrary shell code in earlier compat levels. The dh_installdeb tool will do some basic validation of some of the commands listed in this file to catch common mistakes. The validation is enabled as a warning since compat 10 and as a hard error in compat 12. SEE ALSO
debhelper(7) This program is a part of debhelper. AUTHOR
Joey Hess <joeyh@debian.org> 11.1.6ubuntu2 2018-05-10 DH_INSTALLDEB(1)
All times are GMT -4. The time now is 03:37 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy