- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: Scripting 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
Discussions
Discussions
Forums
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
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
тАО09-20-2006 12:46 AM
тАО09-20-2006 12:46 AM
Scripting Help
I am new to this scripting world. I was wondering if anyone had a script that would find a certian file in my HPUX 11.0.b server then either email it or FTP it out to a certian address. It really help me out. Thank you in advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-20-2006 12:56 AM
тАО09-20-2006 12:56 AM
Re: Scripting Help
There are plenty of threads in this Forum for simple FTP scripts. Simply search for those. One variation is:
#!/usr/bin/sh
ftp -n << EOF
open thehost
user uuu ppp
get /tmp/stuff
close
EOF
...Substitute the appropriate hostname for "thehost". Substitute the appropriate user login and password for the "uuu" and "ppp" strings, respectively, and do a 'get' or 'put' of the file you want, accordingly.
As for finding a file, 'find' is your friend. For example, to find a file containing the characters 'sean' in the directory '/var' you could do:
# find /var -xdev -type f -name "*sean*"
The '-xdev' argument prevents 'find' from crossing mountpoints in its search through the 'var' directory and subdirectories. The '-type f' says look only for *files*, not directories and sockets and pipes. The enclosure of the string "*sean*" in quotes keeps the shell from expanding the wildcard characters and let's 'find' look for any file basename that contains the string "sean" somewhere. Thus, the 'find' would find "sean", "seansfile", "the_sean_file", etc.
Regards!
...JRF...
- Tags:
- ftp
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-20-2006 01:06 AM
тАО09-20-2006 01:06 AM
Re: Scripting Help
if you know there is only one file by that name:
cat `find / -name filename` | mailx -s"Found" email@aol.com
where you replace filename with the filename you are looking for and email@aol.com with your email address.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-20-2006 01:21 AM
тАО09-20-2006 01:21 AM
Re: Scripting Help
find /path -type f -name yourfile -print |xargs mailfile.sh
Hope this helps,
-denver
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-20-2006 01:43 AM
тАО09-20-2006 01:43 AM
Re: Scripting Help
Multiple files matching your search pattern are okay, too:
#!/usr/bin/sh
find /abs_path -type f -name '*query*' -print | xargs tar cvf /tmp/query.${$}.tar
uuencode /tmp/query.${$}.tar query.tar | mailx -m -s "[$(date +%m\/%d\/%y)] query.tar attached" your@email.addr
rm -f /tmp/query.${$}.tar
exit
PCS
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-21-2006 07:41 AM
тАО09-21-2006 07:41 AM
Re: Scripting Help
If thats where you are going to use it ...
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1061204&admit=-682735245+1158777821599+28353475
regards martin at unixera dk