Sponsored Content
Full Discussion: call more options on if
Top Forums UNIX for Advanced & Expert Users call more options on if Post 302687359 by charli1 on Thursday 16th of August 2012 11:57:11 AM
Old 08-16-2012
call more options on if

Hi all,
I'm trying to make a script that will help me a lof on some configuration,
what this should do is to check the files if they exist ,if not the script will send me a mail to notify me that the files does not exist,

but when i call the script to test it,like this
Code:
sh /test/test_script.sh  /test/test_

it says to many arguments ,
and it checks only for the first date format,and skips the other,
how can this be done to check al the date formats and to send me a single mail not 5 mail?
any suggestions are very welcome
thanks in advance.
Code:
#!/bin/sh
{
FILE=$1
TODAY1=`date +%Y-%m-%d`
TODAY2=`date +%Y_%m_%d`
TODAY3=`date +%Y%m%d`
TODAY4=`date +%y-%m-%d-%H-%M`
TODAY5=`date +%y%m%d%H%M`
if [ -e $FILE$TODAY1* ] or [ -e $FILE$TODAY2* ] or [ -e $FILE$TODAY3* ] or [ -e $FILE$TODAY4* ] or [ -e $FILE$TODAY5* ] ;
 then
  echo $FILE  File Exists
else
  echo "$FILE File not Found" | mail -s 'server-test' my.account@my.domain.com
 fi
}

 

7 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

cp options

Hello again, Is there an option for the cp command to overwrite existing files in the destination directory? Cheers Rob (3 Replies)
Discussion started by: milage
3 Replies

2. UNIX for Dummies Questions & Answers

options

I am just beginning to learn unix and I was wondering if there was a list of all the options somewhere on the net or hidden in the man pages? Also do options always have - and then a letter, or can it be - and a number as well? Thanks! (1 Reply)
Discussion started by: terms5
1 Replies

3. AIX

no options

Hi All, I have a situation here that's very fun... I have a system with AIX and iPlanet (sunOne) installed, when occurs an unknown event on the network the WebServer shows a thousand of CLOSE_WAIT connections and this number grows and grows until the webserver crashs. I read some documents... (2 Replies)
Discussion started by: nascimento.rp
2 Replies

4. UNIX for Advanced & Expert Users

how to differentiate system call from library call

Hi, Ho do I differentiate system call from library call? for example if I am using chmod , how do I find out if it is a system call or library call? Thanks Muru (2 Replies)
Discussion started by: muru
2 Replies

5. Infrastructure Monitoring

diffrence between method call and function call in perl

Hello, I have a problem with package and name space. require "/Mehran/DSGateEngineLib/general.pl"; use strict; sub System_Status_Main_Service_Status_Intrusion_Prevention { my %idpstatus; my @result; &General_ReadHash("/var/dsg/idp/settings",\%idpstatus); #print... (4 Replies)
Discussion started by: Zaxon
4 Replies

6. UNIX for Dummies Questions & Answers

Why do I need to call make if I call gcc ?

Why do I need to call make if I call gcc ? I thought gcc already compiles the sources. thanks (1 Reply)
Discussion started by: aneuryzma
1 Replies

7. Ubuntu

Kernel boot options removed by fault, no boot options

Hello Everyone, First of all, I highly appreciate all Linux forum members and whole Linux community. http://forums.linuxmint.com/images/smilies/icon_wink.gif. I wish you the best for all of you ! I will try to be short and concise: I am using Linux Mint 10 for 2 months on 2 ws, and all went... (3 Replies)
Discussion started by: cdt
3 Replies
POSTFIX(1)						      General Commands Manual							POSTFIX(1)

NAME
postfix - Postfix control program SYNOPSIS
postfix [-c config_dir] [-D] [-v] command DESCRIPTION
This command is reserved for the super-user. To submit mail, use the Postfix sendmail command. The postfix command controls the operation of the Postfix mail system: start or stop the master daemon, do a health check, and other main- tenance. The postfix command sets up a standardized environment and runs the postfix-script shell script to do the actual work. The following commands are implemented: check Validate the Postfix mail system configuration. Warn about bad directory/file ownership or permissions, and create missing directo- ries. start Start the Postfix mail system. This also runs the configuration check described above. stop Stop the Postfix mail system in an orderly fashion. Running processes are allowed to terminate at their earliest convenience. Note: in order to refresh the Postfix mail system after a configuration change, do not use the start and stop commands in succes- sion. Use the reload command instead. abort Stop the Postfix mail system abruptly. Running processes are signaled to stop immediately. flush Force delivery: attempt to deliver every message in the deferred mail queue. Normally, attempts to deliver delayed mail happen at regular intervals, the interval doubling after each failed attempt. reload Re-read configuration files. Running processes terminate at their earliest convenience. The following options are implemented: -c config_dir Read the main.cf and master.cf configuration files in the named directory instead of the default configuration directory. Use this to distinguish between multiple Postfix instances on the same host. -D (with postfix start only) Run each Postfix daemon under control of a debugger as specified via the debugger_command configuration parameter. -v Enable verbose logging for debugging purposes. Multiple -v options make the software increasingly verbose. ENVIRONMENT
The postfix command sets the following environment variables: MAIL_CONFIG Directory with Postfix configuration files. MAIL_VERBOSE This is set when the -v command-line option is present. MAIL_DEBUG This is set when the -D command-line option is present. CONFIGURATION PARAMETERS
The following main.cf configuration parameters are made available as process environment variables with the same names: command_directory Directory with Postfix administrative commands. daemon_directory Directory with Postfix daemon programs. config_directory Directory with Postfix configuration files and with administrative shell scripts. queue_directory The directory with Postfix queue files, with local inter-process communication endpoints, and with files needed for daemon programs that run in the optional chrooted environment. mail_owner The owner of Postfix queue files and of most Postfix processes. setgid_group The group for mail submission and queue management commands. sendmail_path The full pathname for the Postfix sendmail command. newaliases_path The full pathname for the Postfix newaliases command. mailq_path The full pathname for the Postfix mailq command. manpage_directory The directory for the Postfix on-line manual pages. sample_directory The directory for the Postfix sample configuration files. readme_directory The directory for the Postfix README files. Other configuration parameters import_environment List of names of environment parameters that can be imported from non-Postfix processes. FILES
$config_directory/postfix-script, administrative commands $config_directory/main.cf, configuration parameters $config_directory/master.cf, Postfix daemon processes SEE ALSO
master(8) Postfix master program LICENSE
The Secure Mailer license must be distributed with this software. AUTHOR(S) Wietse Venema IBM T.J. Watson Research P.O. Box 704 Yorktown Heights, NY 10598, USA POSTFIX(1)
All times are GMT -4. The time now is 01:39 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy