Dear Monks,

I am a Unix/Linux server administrator for a company, and I am a "newbie" in the purest sense of the word in terms of Perl. I'm able to make Perl files using the VI in Unix. I'm trying to get two scripts running--one to stop or start my database server that is running Oracle and one to start or stop my application server that is running Oracle. Currently, I'm entering the commands manually, but I would like to schedule the scripts to run every Friday to shutdown and Monday to startup.

A few of the commands needed to start and stop the database and application servers involve changing directories to execute the commands. How can I write a nice, clean script that can do this?

Thanks, Kris

P.S. Here's a mock-up of what I'm trying to accomplish:

SHUTDOWN

APPLICATION SERVER

login <user>

cd /opt/SIV/inst/apps/SIV_<servername>/admin/scripts ./adstpall.sh pass/pass

login <user>

cd /opt/SIV/db/tech_st/10.2.0 . ./SIV_<servername>.env

sqlplus / as sysdba

shutdown immediate

exit

lsnrctl stop VIS

A similiar script would be needed for the startup.


In reply to Using a Perl Script To Execute a Linux Command by kgill

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.