Professional Web Applications Themes

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

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'; .... ...

  1. #1

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

    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.


    Kafer Guest

  2. #2

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

    [posted & mailed]

    On Wed, 8 Oct 2003, Kafer wrote:
     

    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)

    Jeff Guest

  3. #3

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

    Kafer <com> wrote: 
     

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

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

    I suggest you read the doentation 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 com
    Unix System Administrator Taos - The SysAdmin Company
    Got some Dr Pepper? San Francisco, CA bay area
    < This line left intentionally blank to confuse you. >
    Darren Guest

  4. #4

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

    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" <taos.com> wrote in message
    news:F7Xgb.8770$9%news.prodigy.com... 
    > [/ref]
    am [/ref]
    We [/ref]
    to 
    >
    > Ouch. I can think of *no* reason you would ever want to do an 'init S'
    > on Solaris. 'init 1', maybe.


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

    >
    > I suggest you read the doentation 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 com
    > Unix System Administrator Taos - The SysAdmin Company
    > Got some Dr Pepper? San Francisco, CA bay area
    > < This line left intentionally blank to confuse you. >[/ref]


    Kafer Guest

Similar Threads

  1. Replies: 0
    Last Post: December 20th, 09:35 AM
  2. Replies: 2
    Last Post: December 8th, 02:15 AM
  3. "Continue Loading Content Of Page" Popup
    By Flesh in forum Macromedia Dynamic HTML
    Replies: 0
    Last Post: December 16th, 12:19 PM
  4. "Unable to continue because of a hardware or system error"
    By martin levy in forum Adobe Photoshop Elements
    Replies: 2
    Last Post: July 21st, 06:24 PM
  5. Replies: 1
    Last Post: July 11th, 03:18 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139