Perl Script on Solaris and HP UX | Unix Linux Forums | Shell Programming and Scripting

  Go Back    


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

Perl Script on Solaris and HP UX

Shell Programming and Scripting


Tags
perl script on solaris and hp ux

Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 03-22-2013
yadavricky yadavricky is offline
Registered User
 
Join Date: Aug 2009
Last Activity: 6 August 2014, 12:36 PM EDT
Posts: 41
Thanks: 21
Thanked 0 Times in 0 Posts
RedHat Perl Script on Solaris and HP UX

Dear All,
I am having the Perl script which is using Sudo and it is having a lot of sub programs.
The main task of script is to create create the unix user account and database accounts.

Previous version of platform was Sun Solaris, and now are moving to HP UX.

I am posting this, to know if there are any existing prerequisite or guideline where we can perform sanity check on code.

Or any body is having experience of previous problem and have some suggestion. please share.
Sponsored Links
    #2  
Old 03-22-2013
DGPickett DGPickett is offline Forum Advisor  
Registered User
 
Join Date: Oct 2010
Last Activity: 29 August 2014, 5:00 PM EDT
Location: Southern NJ, USA (Nord)
Posts: 4,409
Thanks: 8
Thanked 539 Times in 517 Posts
Testing is well thought of. Write test cases for plain add, remove and various collision, update cases.
Sponsored Links
    #3  
Old 03-23-2013
hanson44 hanson44 is offline
Registered User
 
Join Date: Mar 2013
Last Activity: 12 May 2013, 11:33 PM EDT
Posts: 858
Thanks: 18
Thanked 180 Times in 177 Posts
Yes, you are taking the right approach. A few suggestions:

Do enough testing with fake accounts to verify correct operation.
At each step of testing, think of ways to make the script malfunction.
Or find a team member who likes to do testing, likes finding glitches.

Make something simple work first. Then add more capabilities.
Use previous logic from script on Solaris, if the code is available.

Every time the script adds a new account, have it display the results,
such as doing a diff between an old and new password file, or showing
a listing of any new files and directories. That's a kind of sanity check.

Spend time upfront picking and sharpening your tools. Use standard
tools you have on the system to add and delete the various account
types. Use any available standard log files for the processes, to help
verify the computer is doing what you want it to.
The Following User Says Thank You to hanson44 For This Useful Post:
yadavricky (04-01-2013)
    #4  
Old 03-25-2013
DGPickett DGPickett is offline Forum Advisor  
Registered User
 
Join Date: Oct 2010
Last Activity: 29 August 2014, 5:00 PM EDT
Location: Southern NJ, USA (Nord)
Posts: 4,409
Thanks: 8
Thanked 539 Times in 517 Posts
Yes, a developer should not test his own stuff!
  • Group code review turns on circuits in your brain that see errors you ignored before. I call it the audience effect.
  • The dialectic tension between tester and developer is also an important resource. You love it, but he loves to find fault.
You deserve pretty code, so indent, tab align, slip in white space to keep things neat. You get paid back in better review, fewer errors and faster fixes. Every time you use a new line or each item, you help track changes in line oriented CM tools like SCCS and diff.

Log like you expect a midnight call when you are on vacation. After years of debugging with bad logging, I am now a fastidious logger and error checker. From first trial run to last is very short, usually, because my code does not go far off the track but I get a nice message and exit. Frame runs in the same log with header and trailer lines and blank lines. Put exact time stamps on all events. It's frustrating to be fixing errors in the wrong log. Put date-time-elements in file names, especially the log. For daemons that run many days, use syslog or start a new log every day. You can have a standard logging routine that saves the integer time() of tomorrow so I can check time() and close the log when necessary, with an old log trailer and the new log with a header.
The Following User Says Thank You to DGPickett For This Useful Post:
yadavricky (04-01-2013)
Sponsored Links
    #5  
Old 04-01-2013
yadavricky yadavricky is offline
Registered User
 
Join Date: Aug 2009
Last Activity: 6 August 2014, 12:36 PM EDT
Posts: 41
Thanks: 21
Thanked 0 Times in 0 Posts
RedHat Useradd cmd in solaris and HPUX

Dear All,
I am having a script which is using the useradd command to create a new user.

it was working fine in solaris but now in HP UX i am getting a prolem. though almost al the option which are available with command are same.

i am using below options

Code:
                [-c comment]
		[-m [-k skel_dir]]
		[-d dir] 
		[-g group] - Security Groupname
		[-G group [, group...]]
		[-s shell]
		[-k skel_dir]

when the script will run it will add the user in /etc/passwd and first the new created account will in locked status.

below is the code which is used to create a account.

Code:
		my $pUserID = shift(@_);
   		my $su;
		my $Cmd = $myConfig::Configuration{useradd};

		my @CmdArgs =  ('-c', 'my Account for ' . $myConfig::Configuration{InstanceName} . ' instance',
				'-m', '-d', $myConfig::Configuration{AccountHome}."/".lc($pUserID),
				'-g', $myConfig::Configuration{SecurityGroupName},
				'-G', 'myscr',
				'-s', '/bin/ksh',
				'-k', $myConfig::Configuration{AccountHome}."/".$myConfig::Configuration{StdAccountName},lc($pUserID));
		$su = Sudo->new(
				{
				 sudo         => $myConfig::Configuration{sudo}
				,sudo_args    => ''
		                ,username     => "root"
				,program      => $Cmd
				,program_args => \@CmdArgs
				}

when i run it in HP US i get below entry in Passwd file

Code:
ARRAY(0x6000000000aca598):x:117:20::/home/ARRAY(0x6000000000aca598):/sbin/sh		ARRAY(0x6000000000aca638):x:118:20::/home/ARRAY(0x6000000000aca638):/sbin/sh

can somebody guide me about error.

To unlock the account i have planned to use /usr/lbin/modprpw with -k which is silmilar to passwd -u but no idea what will be outcome.

Please suggest why strange entry in /ect/passwd file and suggestion

Last edited by Franklin52; 04-02-2013 at 07:49 AM.. Reason: Please use code tags
Sponsored Links
    #6  
Old 04-05-2013
DGPickett DGPickett is offline Forum Advisor  
Registered User
 
Join Date: Oct 2010
Last Activity: 29 August 2014, 5:00 PM EDT
Location: Southern NJ, USA (Nord)
Posts: 4,409
Thanks: 8
Thanked 539 Times in 517 Posts
Wow, severe corruption. Looks like two lines. Any record of who 117 and 118 were, what group 20 is?
Sponsored Links
    #7  
Old 04-05-2013
alister alister is offline
Registered User
 
Join Date: Dec 2009
Last Activity: 11 June 2014, 8:40 PM EDT
Posts: 3,231
Thanks: 179
Thanked 973 Times in 789 Posts
Quote:
Originally Posted by yadavricky View Post

Code:
		my $pUserID = shift(@_);
   		my $su;
		my $Cmd = $myConfig::Configuration{useradd};

		my @CmdArgs =  ('-c', 'my Account for ' . $myConfig::Configuration{InstanceName} . ' instance',
				'-m', '-d', $myConfig::Configuration{AccountHome}."/".lc($pUserID),
				'-g', $myConfig::Configuration{SecurityGroupName},
				'-G', 'myscr',
				'-s', '/bin/ksh',
				'-k', $myConfig::Configuration{AccountHome}."/".$myConfig::Configuration{StdAccountName},lc($pUserID));
		$su = Sudo->new(
				{
				 sudo         => $myConfig::Configuration{sudo}
				,sudo_args    => ''
		                ,username     => "root"
				,program      => $Cmd
				,program_args => \@CmdArgs
				}

when i run it in HP US i get below entry in Passwd file

Code:
ARRAY(0x6000000000aca598):x:117:20::/home/ARRAY(0x6000000000aca598):/sbin/sh		ARRAY(0x6000000000aca638):x:118:20::/home/ARRAY(0x6000000000aca638):/sbin/sh

can somebody guide me about error.
Those ARRAY(hex address) strings are the result of using an array reference as a string.

Regards,
Alister
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Perl : embedding java script with cgi perl script scriptscript Shell Programming and Scripting 1 03-21-2013 12:58 PM
executing perl script from another perl script : NOT WORKING giridhar276 Shell Programming and Scripting 3 08-03-2012 02:34 AM
calling a perl script with arguments from a parent perl script grajp002 Shell Programming and Scripting 1 02-02-2012 11:57 PM
Perl :How to print the o/p of a Perl script on console and redirecting same in log file @ same time. butterfly20 Shell Programming and Scripting 2 01-13-2011 07:35 AM
Solaris+Perl script to get process start date Evan Shell Programming and Scripting 6 04-12-2010 09:37 AM



All times are GMT -4. The time now is 07:50 PM.