- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: script regarding ssh
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
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
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
12-12-2011 09:35 PM
12-12-2011 09:35 PM
Re: script regarding ssh
>> Are you running this script in the right directory? Otherwise with ssh, it would default to the home directory.
I am running the script as:
ssh root@serverB /home/rtns/testdir1/testscript
The script is placed in as above path, but still it is not running.
>>I wouldn't use test(1). I would just use:
if [ -f "$i" ]; then
I tried as above also. But still it is giving the same message as :
+ [ -f abc*.xyz ]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2011 12:11 AM
12-13-2011 12:11 AM
Re: script regarding ssh
>> Are you running this script in the right directory? Otherwise with ssh, it would default to the home directory.
>I am running the script as:
>ssh root@serverB /home/rtns/testdir1/testscript
So the answer to my question is: No
You need to invoke it as:
ssh root@serverB "cd XXXX; /home/rtns/testdir1/testscript"
Where XXXX is the directory you want to check.
Or you could pass this directory on the command line of your script and with some modifications you can look at the script parms.
>But still it is giving the same message as: + [ -f abc*.xyz ]
Of course, my suggestion just makes it faster and cleaner, doesn't fix anything. ;-)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-15-2011 03:30 AM
12-15-2011 03:30 AM
Re: script regarding ssh
HI Dennis,
>>else
: echo "Some files not matched:"
: comm -23 testhoueccp1_files testaustsapdr_files
fi
For the above statement if the files are not matced then the files with the above subject line should be mailed to 4 email addresses. How can i put that in the above statement the 4 addresses.
Regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-15-2011 08:40 AM - edited 12-15-2011 08:40 AM
12-15-2011 08:40 AM - edited 12-15-2011 08:40 AM
Re: script regarding ssh
>How can I put that in the above statement the 4 addresses?
comm -23 testhoueccp1_files testaustsapdr_files | mailx -s "Some files not matched" alias1 ...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2011 03:31 AM
12-19-2011 03:31 AM
Re: script regarding ssh
>>comm -23 testhoueccp1_files testaustsapdr_files | mailx -s "Some files not matched" alias1 ...
I tried with the above command. But i am not receiving the mail. It is showing the below message when running the script :
Null message body; hope that's ok
Regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2011 09:23 AM
12-19-2011 09:23 AM
Re: script regarding ssh
>>comm -23 testhoueccp1_files testaustsapdr_files | mailx -s "Some files not matched" alias1 ...
>I tried with the above command. But I am not receiving the mail: Null message body;
This indicates that you have extra files on testaustsapdr_files but not on testhoueccp1_files.
If you want to see both lists use: comm -3 ...
If you don't care, then you'll need to check to see of the output is empty:
comm -23 testhoueccp1_files testaustsapdr_files > testhoueccp1_only
if [ -s testhoueccp1_only ]; then
mailx -s "Some files not matched" alias1 ... < testhoueccp1_only
fi
rm -f testhoueccp1_only
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2011 09:40 PM
12-19-2011 09:40 PM
Re: script regarding ssh
>>comm -3 testhoueccp1_files testaustsapdr_files | /usr/bin/mailx -s "Some files not matched:" rahul_rtns@domain.com
I am using above to send the mail. When running the script, though it is not giving any message or error, but i am not getting any mail in my mailbox. In my previous post also, i have mentioned this. :)
Regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2011 10:10 PM
12-19-2011 10:10 PM
Re: script regarding ssh
I assumed your script looked like:
cmp -s testhoueccp1_files testaustsapdr_files
if [ $? -eq 0 ]; then
/home/rtns/x/a.sh
ssh root@serverB /home/rtns/testdir1/testscript
else
comm -3 testhoueccp1_files testaustsapdr_files | /usr/bin/mailx -s "Some files not matched:" rahul_rtns@domain.com
fi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2011 10:29 PM
12-19-2011 10:29 PM
Re: script regarding ssh
Hi Dennis,
My script is like this :
#!/usr/bin/sh
ls /home/rtns/testdir/*.abc | sed -e 's:.*/::g' > serverA_files
ssh root@serverB ls "/home/rtns/a/*.abc" | grep "MPF.*\.abc" | sed -e 's:.*/MPF::g' > serverB_files
cmp -s serverA_files serverB_files
if [ $? -eq 0 ]; then
/home/rtns/x/a.sh;
ssh root@serverB "cd /home/rtns/testdir1; /home/rtns/testdir1/testscript"
else
comm -3 serverA_files serverB_files | /usr/bin/mailx -s "Some files not matched:" rahul_rtns@domain.com
fi
rm -f serverA_files serverB_files
All the script is ok, except that i am not getting the mail in my mailbox. Though the script is not giving any error or message.
Regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2011 10:48 PM - edited 12-19-2011 10:50 PM
12-19-2011 10:48 PM - edited 12-19-2011 10:50 PM
Re: script regarding ssh
>I am not getting the mail in my mailbox.
Perhaps you don't have your system configured properly to send mail?
What does this do:
echo hello | mailx -s "test mail" rahul_rtns@domain.com
Take a look at /var/adm/syslog/mail.log.
If your problem is not obvious, search the "Messaging" board. And then if no solutions, post another topic there.