- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Help with a perl script subroutine...
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
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
тАО10-13-2005 02:16 PM
тАО10-13-2005 02:16 PM
Help with a perl script subroutine...
It's called from the following lines:
#*****************************************
if ($APPLI_CNT > 0)
{
print "................>";
for ($j = 0; $j < scalar(@LES_APPLI); $j++)
{
chomp($LES_APPLI[$j]);
print "\n>>>>>>>App nber ", $j + 1, " is ", uc($LES_APPLI[$j]),"\n";
for ($t = 0; $t < scalar(@phases) ; $t++)
{
if ($LES_APPLI[$j] =~ /aaa|bbb|ccc|ddd/ )
{
$newpath = "/main/obe/$phases[$t]/$LES_APPLI[$j]/com/core";
print "check: $newpath\n";
new_path "$newpath";
}
elsif ($LES_APPLI[$j] =~ /eee|fff|ggg/ ) # special treatment needed for the CPX application
{
$environmentfile = "/main/obe/$phases[$t]/$LES_APPLI[$j]/com/etc/cfg/environment_$LES_APPLI[$j]";
print "check: $environmentfile\n";
look_for_environment "$environmentfile";
}
elsif ($LES_APPLI[$j] =~ /hhh/ ) # special treatment needed for the NGI
{
$environmentfile = "/main/obe/$phases[$t]/$LES_APPLI[$j]/com/etc/cfg/environment_com";
print "check: $environmentfile\n";
look_for_environment "$environmentfile";
}
else
{
$environmentfile = "/main/obe/$phases[$t]/$LES_APPLI[$j]/etc/cfg/environment_$LES_APPLI[$j]";
print "check: $environmentfile\n";
look_for_environment "$environmentfile";
}
}
}
}
#******************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-13-2005 02:19 PM
тАО10-13-2005 02:19 PM
Re: Help with a perl script subroutine...
Problem... It's looking at the array results and what it found then attempting to remove the files when they have already been removed; it then complains with errors like the following:
++++++++++++++++++++++++++++++++++++++
/main/obe/TST1/bbb/bint/core.20050928 not found
/usr/local/bin/sudo: Illegal option -f
usage: sudo -V | -h | -L | -l | -v | -k | -K | [-H] [-P] [-S] [-b] [-p prompt]
[-u username/#uid] -s |
/main/obe/TST1/bbb/bint/core.20050930 not found
/usr/local/bin/sudo: Illegal option -f
usage: sudo -V | -h | -L | -l | -v | -k | -K | [-H] [-P] [-S] [-b] [-p prompt]
[-u username/#uid] -s |
/main/obe/TST1/bbb/bint/core.20050929 not found
/usr/local/bin/sudo: Illegal option -f
usage: sudo -V | -h | -L | -l | -v | -k | -K | [-H] [-P] [-S] [-b] [-p prompt]
[-u username/#uid] -s |
/main/obe/TST1/bbb/bint/core.20050926 not found
/usr/local/bin/sudo: Illegal option -f
usage: sudo -V | -h | -L | -l | -v | -k | -K | [-H] [-P] [-S] [-b] [-p prompt]
[-u username/#uid] -s |
/main/obe/TST1/bbb/bint/core.20050922 not found
/usr/local/bin/sudo: Illegal option -f
usage: sudo -V | -h | -L | -l | -v | -k | -K | [-H] [-P] [-S] [-b] [-p prompt]
[-u username/#uid] -s |
++++++++++++++++++++++++++++++++++++++
This, after the files were actually found, they were there, they were also removed as per the subroutine's params... anyone see the mistake I've made on the modifications I have used?
Thanks for any ideas...
MAD
- Tags:
- sudo
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-13-2005 07:08 PM
тАО10-13-2005 07:08 PM
Re: Help with a perl script subroutine...
system "/usr/local/bin/sudo -H -u $uid /usr/bin/rm -f $veri" ;
and the sudo you have installed states id does not support the -f option:
usage: sudo -V | -h | -L | -l | -v | -k | -K | [-H] [-P] [-S] [-b] [-p prompt][-u username/#uid] -s |
So you will have to consult the man page of the installed sudo to check what options do what, and what to replace -f with.
Or get yourself a working copy of the sudo that *does* support the -f in the way the author of the sub intended it to be used.
Standards++; :)
Enjoy, Have FUN! H.Merijn
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-13-2005 07:09 PM
тАО10-13-2005 07:09 PM
Re: Help with a perl script subroutine...
# which rm
Is it /usr/bin/rm?
# touch testfile
Test 1:
# /usr/local/bin/sudo -H -u $uid /usr/bin/rm -f testfile
Test2:
# /usr/local/bin/sudo -H -u $uid /usr/bin/rm -f testfile
What are you getting for this now?
hth.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-13-2005 10:44 PM
тАО10-13-2005 10:44 PM
Re: Help with a perl script subroutine...
I must agree with procura's thought because at first I also thought this to be the issue, however the "sudo" I am using supports the "rm -f" being used. Furthermore, here is also another sub running in the same script using exactly the same sudo pattern which does not toss out any errors at all. So, this had my very intriged, and I tried a few other variations, amongst them the one pointed out by hth:
/usr/local/bin/sudo -H -u
The problem resulted being the same when using that pattern. However, in either case I must also state that the desired files to be removed "were removed!" So, the sudo itself is working. It appears as if it is again looking for the files which no longer exist.
About the questions last asked by hth:
1) node> which rm
/usr/bin/rm
2) I tried both (either works):
node> /usr/local/bin/sudo -H -u pdttdm /usr/bin/rm core.20051003
and
mucobt32> /usr/local/bin/sudo -H -u
So, the problem lies elsewhere (I wish I knew where)...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-13-2005 11:02 PM
тАО10-13-2005 11:02 PM
Re: Help with a perl script subroutine...
call perl with the -w option to show you undef warnings
Enjoy, Have FUN! H.Merijn