Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > I'm a newbie: need to script "init S", then continue running code

Reply
Thread Tools

I'm a newbie: need to script "init S", then continue running code

 
 
Kafer
Guest
Posts: n/a
 
      10-08-2003
Hi all,

I am very new to Perl, so please bear with my lack of experience here. I am
in the process of writing a couple of short Perl scripts to handle some
automated backup procedures to be shipped to some of our customer sites. We
are running Solaris 8 / SPARC, and would like our script to change from
runlevel 3 to runlevel S before executing any code, effectively we want to
issue an "init S" (prompting for root password is ok), then execute our
code.

I can do the init S bit via:

exec init => 'S';

.... but of course the script effectively dies at that point. Any ideas? I
don't mind reading if someone knows a how-to or good cookbook site.


Thanks in advance.


 
Reply With Quote
 
 
 
 
Jeff 'japhy' Pinyan
Guest
Posts: n/a
 
      10-08-2003
[posted & mailed]

On Wed, 8 Oct 2003, Kafer wrote:

>I can do the init S bit via:
>
>exec init => 'S';
>
>... but of course the script effectively dies at that point. Any ideas? I
>don't mind reading if someone knows a how-to or good cookbook site.


That's what exec() DOES. It replaces the current process with the one you
give it. It says "stop running me, and run THIS program instead". You
either want to use system(), which runs the program you tell it to and
THEN returns to the Perl program, or a fork-exec combination.

--
Jeff Pinyan RPI Acacia Brother #734 2003 Rush Chairman
"And I vos head of Gestapo for ten | Michael Palin (as Heinrich Bimmler)
years. Ah! Five years! Nein! No! | in: The North Minehead Bye-Election
Oh. Was NOT head of Gestapo AT ALL!" | (Monty Python's Flying Circus)

 
Reply With Quote
 
 
 
 
Darren Dunham
Guest
Posts: n/a
 
      10-08-2003
Kafer <(E-Mail Removed)> wrote:
> Hi all,


> I am very new to Perl, so please bear with my lack of experience here. I am
> in the process of writing a couple of short Perl scripts to handle some
> automated backup procedures to be shipped to some of our customer sites. We
> are running Solaris 8 / SPARC, and would like our script to change from
> runlevel 3 to runlevel S before executing any code, effectively we want to
> issue an "init S" (prompting for root password is ok), then execute our
> code.


Ouch. I can think of *no* reason you would ever want to do an 'init S'
on Solaris. 'init 1', maybe.

> I can do the init S bit via:


> exec init => 'S';


*boggle*. You know, I suppose that works just fine, but I would never
write it that way. Why have you used the '=>' operator there?

> ... but of course the script effectively dies at that point. Any ideas? I
> don't mind reading if someone knows a how-to or good cookbook site.


I suggest you read the documentation that comes with perl first.

% perldoc -f exec
exec LIST
exec PROGRAM LIST
The "exec" function executes a system command and
never returns-- use "system" instead of "exec" if
you want it to return.

--
Darren Dunham http://www.velocityreviews.com/forums/(E-Mail Removed)
Unix System Administrator Taos - The SysAdmin Company
Got some Dr Pepper? San Francisco, CA bay area
< This line left intentionally blank to confuse you. >
 
Reply With Quote
 
Kafer
Guest
Posts: n/a
 
      10-08-2003
We do an init S to settle down the filesystem before doing a backup via
ufsdump. This script is intended to check the stability of a DiskSuite
mirrored array, bring the system down to init S, detach the array, then dump
the secondary slice. From what I've been reading, it looks like exec will
get me through init S, but what about code after init S?

I was toying with the idea of a one-time rc script to pickup in init S where
init 3 left off, but I hate having scripts lying around that may not get
cleaned up properly in the event of a problem, especially when it could
impact a filesystem.


"Darren Dunham" <(E-Mail Removed)> wrote in message
news:F7Xgb.8770$9%(E-Mail Removed) m...
> Kafer <(E-Mail Removed)> wrote:
> > Hi all,

>
> > I am very new to Perl, so please bear with my lack of experience here. I

am
> > in the process of writing a couple of short Perl scripts to handle some
> > automated backup procedures to be shipped to some of our customer sites.

We
> > are running Solaris 8 / SPARC, and would like our script to change from
> > runlevel 3 to runlevel S before executing any code, effectively we want

to
> > issue an "init S" (prompting for root password is ok), then execute our
> > code.

>
> Ouch. I can think of *no* reason you would ever want to do an 'init S'
> on Solaris. 'init 1', maybe.
>
> > I can do the init S bit via:

>
> > exec init => 'S';

>
> *boggle*. You know, I suppose that works just fine, but I would never
> write it that way. Why have you used the '=>' operator there?
>
> > ... but of course the script effectively dies at that point. Any ideas?

I
> > don't mind reading if someone knows a how-to or good cookbook site.

>
> I suggest you read the documentation that comes with perl first.
>
> % perldoc -f exec
> exec LIST
> exec PROGRAM LIST
> The "exec" function executes a system command and
> never returns-- use "system" instead of "exec" if
> you want it to return.
>
> --
> Darren Dunham (E-Mail Removed)
> Unix System Administrator Taos - The SysAdmin Company
> Got some Dr Pepper? San Francisco, CA bay area
> < This line left intentionally blank to confuse you. >



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
continue the execution of a ruby script after a shell comand Hamlat Ameziane Ruby 3 07-17-2008 07:59 AM
Help. SessionID is x then y then x then y BodiKlamph@gmail.com ASP General 0 09-03-2005 03:02 PM
javascript to check the text of a textbox and then continue buran ASP .Net 2 03-28-2005 02:01 PM
exit from command and continue the script Ram Java 2 02-24-2004 05:52 PM
Ending Function on Error then Continue in main() - Steve - C++ 3 07-29-2003 01:56 PM



Advertisments