- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- script for File exist or not...
Operating System - Linux
1745932
Members
4548
Online
108723
Solutions
Forums
Categories
Company
Local Language
юдл
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
юдл
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-14-2009 07:42 PM
тАО10-14-2009 07:42 PM
script for File exist or not...
Hi,
one application is running on my server. that application will create one log file . when creating that log file automatically send mail from that server.that log file will be available for some time then i will be deleted. after deleting that file i should receive mail .
How to write sript for this? please help
Thanks in advance
one application is running on my server. that application will create one log file . when creating that log file automatically send mail from that server.that log file will be available for some time then i will be deleted. after deleting that file i should receive mail .
How to write sript for this? please help
Thanks in advance
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-14-2009 09:24 PM
тАО10-14-2009 09:24 PM
Re: script for File exist or not...
Hello.
Use your shell's test built-in:
man 1 test
man bash
For bash this is documented under CONDITIONAL EXPRESSIONS section of the man page.
The most trivial:
if [ -f /path/to/file ]
then
echo file exists
else
echo file not there
fi
Another option is to use inotify subsystem with tools like incron, inotify-tools or iwatch.
Regards,
Goran
Use your shell's test built-in:
man 1 test
man bash
For bash this is documented under CONDITIONAL EXPRESSIONS section of the man page.
The most trivial:
if [ -f /path/to/file ]
then
echo file exists
else
echo file not there
fi
Another option is to use inotify subsystem with tools like incron, inotify-tools or iwatch.
Regards,
Goran
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-15-2009 09:03 PM
тАО10-15-2009 09:03 PM
Re: script for File exist or not...
You could also use:
if [ -r file]
because if it is there but you can't read it due to permissions, it won't be a lot us of use to you?
if [ -r file]
because if it is there but you can't read it due to permissions, it won't be a lot us of use to you?
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
News and Events
Support
© Copyright 2024 Hewlett Packard Enterprise Development LP