- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Script help
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
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
Community
Resources
Forums
Blogs
- 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
03-27-2002 05:31 AM
03-27-2002 05:31 AM
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2002 05:38 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2002 05:41 AM
03-27-2002 05:41 AM
Re: Script help
# cd /tmp
# touch AAA1
# touch AAA2
# echo hello>AAA2
# ls -l AAA*
-rw-rw-rw- 1 root sys 0 Mar 27 08:28 AAA1
-rw-rw-rw- 1 root sys 6 Mar 27 08:29 AAA2
# find /tmp -type f -name "AAA*" -size +0c
/tmp/AAA2
# find /tmp -type f -name "AAA*" -size +0c -exec ls -l {} \; | mail SOMEUSE@SOMEWHERE.com
THEN, create a simple script with this in it:
find /tmp -type f -name "AAA*" -size +0c -exec ls -l {} \; | mail SOMEUSE@SOMEWHERE.com
live free or die
harry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2002 05:44 AM
03-27-2002 05:44 AM
Re: Script help
Try this:
cd /net/bin > /dev/null
l -1 >! fic
foreach file ('cat fic')
if ( (! -z ${file} && (-e ${file}) ) then
...
...
...
endif
end
FRANK.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2002 05:58 AM
03-27-2002 05:58 AM
Re: Script help
you could such like this:
DIR=/directory
FILE=file
while :
do
if [ -s $DIR/$FILE ]
then
cat $DIR/$FILE | mailx user@domain
mv $DIR/$FILE $DIR/$FILE.old
fi
sleep 10
done
This will look every 10 seconds for file and if it has size > 0 it will be mailed and then renamed.
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2002 07:08 AM
03-27-2002 07:08 AM
Re: Script help
This gives you all of the possible switches you can give to an "if" statement.
I.E.
if [ -n FILE ] ; then
echo "the file exists and is not zero size".
elif [ -z FILE ] ; then
echo "the file exists and is zero size"
fi
Note that to properly do this, you should embed this in a check for the file first! I.E.
if [ -f FILE ] ; then
if [ -n FILE ] ; then
echo "file is there, and has size <0"
else
echo "file is there, but has 0 size"
fi
else
echo "the file is not there".
fi
Again, man pages are your friends, but it can be hard to know where to look!
Regards,
Shannon
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2002 07:17 AM
03-27-2002 07:17 AM
Re: Script help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2002 08:27 AM
03-27-2002 08:27 AM
Re: Script help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2002 08:34 AM
03-27-2002 08:34 AM
Re: Script help
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2002 08:43 AM
03-27-2002 08:43 AM
Re: Script help
find /playpen/data -type f -name "AAA*" -size +0c -exec ls -l {} \; | grep -v -e "\/somedirA/\" -e "\/somedirB\/" -e "\/somedirC\/" | mail SOMEUSE@SOMEWHERE.com
live free or die
harry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2002 09:00 AM
03-27-2002 09:00 AM
Re: Script help
#
DIR2SRCH="/playpen/data"
FILE2FIND="AAA*"
EXCLUDETHESEDIRS='-e \/uuuu\/ -e \/yyyy\/ -e \/zzzz\/'
#
find ${DIR2SRCH} -type f -name "${FILE2FIND}" -size +0c -exec ls -l {} \; | grep
-v ${EXCLUDETHESEDIRS} | mail SOMEUSE@SOMEWHERE.com
in a script
live free or die
harry