Shell Script Help

I'm an IBM guy and I was assigned this MAC projet. I'm a MAC noob. I have a multi-user eMac. The user account folders are blown away when the computer shuts down leaving just the root accout and default account. I included a new javapolicy file in the default user account. A file called java.policy resides in the user home folder at log in (/users/johndoe/java.policy) for every new user that logs in. I need to create a logon shell script that finds the java.policy file in their home folder and renames it .java.policy to make it hidden. Remaming it in the default profile is not an option, and I don't know who will be using the computer at any given day. Can someone help me with the code.
#!/bin/bash/
I'm clueless, thanks for the help

The generic bash rename syntax for your specified command is:
mv /Users/shortuser/javapolicy /Users/shortuser/.java.policy
Here's a typical script:
#!/bin/bash
mv /path/to/source/.java.policy /Users/shortuser/.java.policy
The most direct mechanism would be via a computer login preference and workgroup manager, setting up a script that executes at user login. That script is invoked at login and can copy over or create the required file. Another of the usual techniques for executing commands at login is the so-called [login hook (HT2420)|http://support.apple.com/kb/HT2420], though if you're using Open Directory (OD) or OD with Active Directory (AD), it'll probably be better to go that way than the login hook.
Other discussions [here|http://arstechnica.com/civis/viewtopic.php?f=20&t=416343] and [here|http://www-personal.umich.edu/~lsiden/tutorials/signed-applet/signed-appl et.html]
I'd tend to expect to see the policytool used for this file, too. Launch Terminal.app and see +man policytool+ for details on that.
I'd also tend to expect to see this sort of stuff established within the system-wide policy module from the JRE that's usually located in [the system library directory |http://stackoverflow.com/questions/4372060/java-security-file-location-on-mac- snow-leopard] (/Library/Java/Home/lib/security/java.policy) and not with a per-user setting, too, and that's a rather different approach than populating the per-user settings. (But then I'm not a Java geek.)
FWIW, it's "Mac" and not "MAC", it's Unix, and files and directories doesn't get blown away unless there's a problem somewhere, or unless this is a school or kiosk or other environment that's using specific system-reset processing. And if there's system-reset processing here, then you'll obviously need to work within that. That processing is usually associated with OD, hence the earlier pointers. (And if there's this sort of reset processing going on, there's usually a reason for it, I'd probably try to keep as much sensitive stuff out of the local directories as I could reasonably manage.)

Similar Messages

  • Unix shell Script Help

    Hi,
    I am not to familiar with shell scripting. And i need a shell script that would look for a certain filename (eg: ASN*.txt) in a directory(Eg:data) and if it does find that, it calls a concurrent program(Eg: abc.xyz) and once this is called and procedure excutes successfully, I take the file and move it to another directory(Eg:archive)
    Any help would be aprreciated.
    Thanks,
    Ja

    You bet.
    http://steve-parker.org/sh/sh.shtml
    http://heather.cs.ucdavis.edu/~matloff/UnixAndC/Unix/CShellII.html
    and about 300,000 more hits on Google

  • Startup shell script help for newbie?

    New to UNIX (linux)... need the bash shell script commands for my r.c local file to start my services when server boots.
    I got my ds, dps and admin server in their respective /opt directories. I need the shell commands to have these start. Of course I can start them manually but when I try a line like this in a script, it doesnt work:
    ./var/opt/sun/directory-server/slapd-dsserver/start-dsserver
    Some path problem or dot thing?

    There are a few other things you may want to consider, such as what the default browser is, are tabs being used, is the page loaded yet, etc, but Safari has a do javascript command in it's scripting dictionary. The following script will open a new document and run your specified javascript, or you can go to their NPR Program Stream Page and download a playlist that will run directly from iTunes.
    <pre style="
    font-family: Monaco, 'Courier New', Courier, monospace;
    font-size: 10px;
    margin: 0px;
    padding: 5px;
    border: 1px solid #000000;
    width: 720px; height: 335px;
    color: #000000;
    background-color: #FFDDFF;
    overflow: auto;"
    title="this text can be pasted into the Script Editor">
    set my_script to "NPR.Player.openPlayer(2, 0, '03-21-2008', NPR.Player.Action.PLAY_NOW, NPR.Player.Type.PROGRAM, NPR.Player.Mode.LIVE)"
    tell application "Safari"
    activate
    set the URL of the front document to "http://www.npr.org/"
    if my page_loaded(20) is false then error numner - 128 -- page not loaded in time
    do JavaScript my_script in document 1
    end tell
    on page_loaded(timeout_value) -- from http://www.apple.com/applescript/archive/safari/jscript.01.html
    delay 2
    repeat with i from 1 to the timeout_value
    tell application "Safari"
    if (do JavaScript "document.readyState" in document 1) is "complete" then
    return true
    else if i is the timeout_value then
    return false
    else
    delay 1
    end if
    end tell
    end repeat
    return false
    end page_loaded
    </pre>

  • Shell script help required

    hi
    scenario: A folder contains n - number of folder which contains few generated pdf reports.
    NOW I need a shell script which will solve two purpose simultaneously:
    1. it will create folder for each folders in the specific directory according to the month and year AND it will copy the respected folder within them including the pdf files.
    2. The newly created folders will be converted into a tar compressed file.
    EXAMPLES:
    Say the folder name is E-SEVA wich contains folders say 10_MAR_2011,12_MAR_2011 and n_YthMonth_2011 and same for 2012 year also.Now I need folders rather a tarz file for each month say MARCH_2011,FEB_2011,MARCH_2012,FEB_2012 and so on.
    kind regards

    The following should do:
    months="JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC"
    years="2011 2012"
    dir="E-SEVA"
    cd "$dir"
    for month in $months; do
       for year in $years; do
          for folder in $(find . -type d -name "*_${month}_${year}"); do
             mkdir -p "${month}_${year}"
             cp -pR "$folder" "${month}_${year}/"
             tar -rf "${month}_${year}.tar" "${month}_${year}"
          done
       done
    doneNote: You cannot add files to a compressed archive.

  • Shell scripts  help

    Hi, I am not experienced in shell scripts, I hope someone can give some hint for the following problem
    I have html file like this
    <html>
    <body>
    Some stuff
    More stuff
    <pre>
    A
    B
    </pre>
    Still more stuff
    And more
    <pre>
    C
    D
    </pre>
    Additional stuff
    </body>
    </html>
    I want to write the script to red this file and dump out
    The items within the <pre> tags. For example, the output for the above file
    shouild be
    A
    B
    C
    D
    Thanks
    Angela

    Hi,
    I have tried to go little far and created a little complicated solution.
    This may be usefull if,
    1) There are more than one <pre></pre> pairs in one line
    2) The <pre> tag can come in mixed case
    3) And you want everything as it is in the <pre> tag
    Means if the f.html file is,
    <body>
    My name is Einstein <pre>HA ha</PRE> and I am trying <PRE> FUNNY </Pre>
    things just for practise. This may be <pre>usefull</Pre> or it may <pre>
    not
    be usefull</pre> but its fun.
    </body>
    It should give,
    HA ha
    FUNNY
    usefull
    not
    be usefull
    Do the following,
    Create a file one.sed with following contents
    s/[<][Pp][rR][eE][>]/<PRE>/g
    s/[<]\/[Pp][rR][eE][>]/<\/PRE>/g
    Create a file two.awk with following contents
    gsub(/<PRE>/,"\n<PRE>");
    if (substr($0,1,6) != "</PRE>") {gsub(/<\/PRE>/,"\n<\/PRE>");}
    print
    Create a file three.awk with following contents
    BEGIN{v1=0}
    if ( match($0,/<\/PRE>/) != 0 ) { v1 = 0;}
    if ( match($0,/<PRE>/) != 0 ) { v1 = 1 ;}
    if (v1 == 1) { gsub(/<PRE>/,"");if (length($0) != 0) {print $0;} }
    And finally run the command,
    sed -f one.sed f.html | nawk -f two.awk | nawk -f three.awk
    Its not complex.
    one.sed will convert all <pre> tags to all capital letters.
    two.awk will move all <PRE> and </PRE> tags on new line, means <PRE> and </PRE> will always be first string in a line or it will not be there.
    three.awk will print out the actual contents between <PRE> and </PRE> pairs.
    If your requirement is even more complex then what I have done, please use perl instead of shell. Also, perl is consistant across Unix platforms. sed and awk are not. On Solaris you will have to use 'nawk' but on HP/AIX you have to use 'awk' and on Linux you may have to use 'gawk'.
    Cheers....have fun.
    Let me know any further complications and if you need a perl script.

  • Trying to create a shell script to cut/paste files in finder. Help needed.

    I'm trying to create an automator shell script to cut/paste. It'll function exactly like copy/paste. i.e. I'll just copy file/files with command+c like always, but then I'll create an automator which uses the "mv" terminal app to move the files which works exactly like cut paste.
    I need some help since I don't know the syntax for creating shell scripts.
    What I did so far is to do it in automator with Apple Script which goes like the following:
    on run {input, parameters}
    tell application "Finder"
    set theWindow to window 1
    set thePath to quoted form of (POSIX path of (target of theWindow as string))
    end tell
    tell application "Terminal"
    do script with command "mv \"" & input & "\"" & thePath in window 1
    end tell
    return input
    end run
    This gets the copied file path from clipboard before, as input, and then recognizes the active finder window as thePath so then executes the mv command for the input file to the thePath window.
    It doesn't work as expected since it connects both file/window paths into a single path instead of leaving a space between them so the mv command can't recognize two separate paths.
    What's the correct syntax for that line
    do script with command "mv \"" & input & "\"" & thePath in window 1
    to leave a space between input and thePath under the mv command?
    Also this requires the terminal app to be open in the background.
    After I get this to work I want to do the exact same thing using shell script within automator, so I won't need Terminal to be open all the time.
    And the next step will be to cut/paste multiple files/folders but that should be easy to do once I get the hang of it.

    Try using:
    on run {input, parameters}
    tell application "Finder"
    set theWindow to window 1
    set thePath to quoted form of (POSIX path of (target of theWindow as string))
    end tell
    do shell script "mv \"" & input & "\" " & thePath
    return input
    end run
    (45977)

  • Need Help in creating Unix Shell Script for database

    Would be appreciable if some one can help in creating unix shell script for the Oracle DB 10,11g.
    Here is the condition which i want to implement.
    1. Create shell script to create the database with 10GB TB SPACE and 3 groups of redo log file(Each 300MB).
    2. Increase size of redolog file.
    3. Load sample schema.
    4. dump the schema.
    5. Create empty db (Script should check if db already exists and drop it in this case).
    6. Create backup using rman.
    7. restore backup which you have backed up.

    This isn't much of a "code-sharing" site but a "knowledge-sharing" site.  Code posted me may be from a questioner who has a problem / issue / error with his code.   But we don't generally see people writing entire scripts as responses to such questions as yours.  There may be other sites where you can get coding done "for free".
    What you could do is to write some of the code and test it and, if and when it fails / errors, post it for members to make suggestions.
    But the expectation here is for you to write your own code.
    Hemant K Chitale

  • Please help me remove the last elements of shell script from my applescript

    I read somewhere that running a shell script in an applescript was inefficient and created extra overhead, fine, so I am trying to take all of my shell script out of my applescript (this should fix issues with forward slashes in names as well...)
    however I am stuck on these last two lines (I know they are probably trivial but I've been up waaaay too long now) so I was wondering if anyone would be awesome enough to show me how to convert the bash to applescript.
    --does a recursive copy and rename
    do shell script "cp -R " & (thePath as text) & " " & (theOtherPathWithFile as text)
    --does a copy and rename, then a simple move
    do shell script "cp " & (quoted form of (POSIX path of this_item as text)) & " " & (theNewPath as text) & "&& mv " & (theOtherPathWithFile as text) & " ~/Desktop"
    Any and all help will be appreciated.

    There isn't anything wrong with using shell scripts, especially since AppleScript is designed to do this very thing. There is some overhead when using do shell script, just as there is some overhead when using an application tell statement, so it just depends on what you are doing.
    The performance of any particular script would also be up to whatever is acceptable to you (or your customers), and sometimes a shell script is the most efficient way to do something. Many of the system utilities are just GUI front-ends to a shell script, so they can't be all bad.
    To do your file copy or move with the Finder, you will need to tell it to duplicate or move the item(s) (there is that pesky overhead again). Shell scripts use POSIX paths while the Finder uses colons as its path delimiter, so you will need to use the correct file path references - there is a decent article about that at Satimage. Once your file paths have been defined (or using something like choose file or choose folder)), your script would be something like:
    <pre style="
    font-family: Monaco, 'Courier New', Courier, monospace;
    font-size: 10px;
    font-weight: normal;
    margin: 0px;
    padding: 5px;
    border: 1px solid #000000;
    width: 720px;
    color: #000000;
    background-color: #DAFFB6;
    overflow: auto;"
    title="this text can be pasted into the Script Editor">
    tell application "Finder"
    duplicate source to destination
    -- move source to destination
    end tell
    </pre>
    See the Finder and *System Events* scripting dictionaries for more information about the ways they deal with files.

  • Help changing permissions using a shell script

    Hey,
    Here's the situation. We have 18 Macs, they're all cloned from a master image and have 2 local accounts - Administrator and Student.
    There are some files on the machines that the student account does not have permission to access, but it's critical that they do. I've written a shell script to change the files so that everyone has permission to read, write and execute them:
    #! /bin/bash
    clear
    sudo chmod ugo+rwx /Library/Audio/Plug-ins/Components/FM8.component
    sudo chmod ugo+rwx /Library/Audio/Plug-ins/VST/FM8.vst
    sudo chmod ugo+rwx /Library/Audio/Plug-ins/VST/FM8\ FX.vst
    sudo chmod ugo+rwx /Library/Application\ Support/Digidesign/Plug-ins/FM8.dpm
    In theory, this means I can just run the script, type the admin password in once and its done (as opposed to typing in the password 4 times and navigating to each file individually.)
    However, this doesn't quite work as planned.
    If I run the script, navigate to the files using the Finder and 'get info' it declares that "Everyone" can "Read & Write". The student account can see the file properly, but the finder just thinks there's nothing there (Size=Zero KB.) Only when I explicitly add the Student account (Add->Student) and set it to "Read & Write" does it start working.
    2 questions really - Why does it do this, and how do I make it work?
    It was my understanding that if everyone could read, write and execute there wouldn't be a problem, regardless of which account tries to access the file?
    Also, if there is a better/easier/faster way of doing the same thing I'm open to suggestions.
    Thanks.

    Thanks Tony,
    Your reply was helpful, I didn't realise you could tie all the paths together and just use one chmod command.
    I actually solved the issues myself this morning (fresh head on after a good nights sleep!)
    It turns out the 'files' I'm trying to modify aren't strictly files at all, they're packages. Using just chmod changes permissions for the top of the package only (hence why I could see the files but they said Zero KB.)
    adding -R to the chmod modified permissions to everything inside the package as well, which has resolved the issue.
    Thanks for the help though!

  • Please help to call oracle procedure with out paramter from shell script

    Hi
    I want to call a process with out parameter from shell script. I am calling process in shell script in below way
    function Process_loads {
    ( echo 'set serveroutput on size 1000000 arraysize 1'
    echo "set pagesize 0 term on verify off feedback off echo off"
    echo "BEGIN"
    echo " dbms_output.put_line('Before Calling The package'); "
    echo " x ( '$1', '$2', '$2', '$4', '$5', '$error_code'); "
    echo " dbms_output.put_line('After Calling The package'); "
    echo "EXCEPTION "
    echo " WHEN OTHERS THEN "
    echo " dbms_output.put_line('BIN_LOAD_ERROR' || SQLERRM); "
    echo " ROLLBACK;"
    echo "END;"
    echo "/" ) | sqlplus -s $USER/$PASSWORD@$SID
    Here $error_code is out paramter. All varaibles passed in process are declared with export command.
    When executing .sh it gives below error
    "sh ERROR at line 3: ORA-06550: line 3, column 99: PLS-00363: expression '' cannot be used as an assignment target ORA-06550: line 3, column 3: PL/SQL: Statement ignored".
    Please help to get rid from this error or please suggest how to call a oracle procedure with out paramter from unix shell script.
    Thanks in advance

    You can try this:
    From sql*plus
    SQL> ed
      1  create or replace procedure my_proc(p_id in int, p_result out int)
      2  as
      3  begin
      4  select 10 * p_id
      5  into p_result
      6  from dual;
      7* end my_proc;
    SQL> /
    Procedure created.
    SQL> set serveroutput on
    SQL> declare
      2  v_r int;
      3  begin
      4  my_proc(10,v_r);
      5  dbms_output.put_line(v_r);
      6  end;
      7  /
    100
    PL/SQL procedure successfully completed.
    from bash:
    testproc.sh:
    #!/bin/bash
    (echo 'set serveroutput on';
    echo 'declare';
    echo 'v_r int;';
    echo 'begin';
    echo 'my_proc(10,v_r);';
    echo 'dbms_output.put_line(v_r);'
    echo 'end;';
    echo '/';) | sqlplus -s u1/u1
    Console:
    oracle@mob-ubuntu:~$ chmod u+x testproc.sh
    oracle@mob-ubuntu:~$ ./testproc.sh
    100
    PL/SQL procedure successfully completed.With kind regards
    Krystian Zieja

  • Need Help on Executing Shell Scripts through PL-SLQ

    Hi All,
    I am trying to execute a shell script from PL-SQL but I am not getting it right .
    the code i used is as follows
    ----JAVA CLASS ---
    CREATE OR REPLACE AND COMPILE JAVA SOURCE NAMED "Host" AS
    import java.io.*;
    public class Host {
    public static void executeCommand(String command) {
    try {
    String[] finalCommand;
    if (isWindows()) {
    finalCommand = new String[4];
    // Use the appropriate path for your windows version.
    finalCommand[0] = "C:\\windows\\system32\\cmd.exe"; // Windows XP/2003
    //finalCommand[0] = "C:\\winnt\\system32\\cmd.exe"; // Windows NT/2000
    finalCommand[1] = "/y";
    finalCommand[2] = "/c";
    finalCommand[3] = command;
    else {
    finalCommand = new String[3];
    finalCommand[0] = "/bin/sh";
    finalCommand[1] = "-c";
    finalCommand[2] = command;
    final Process pr = Runtime.getRuntime().exec(finalCommand);
    pr.waitFor();
    new Thread(new Runnable(){
    public void run() {
    BufferedReader br_in = null;
    try {
    br_in = new BufferedReader(new InputStreamReader(pr.getInputStream()));
    String buff = null;
    while ((buff = br_in.readLine()) != null) {
    System.out.println("Process out :" + buff);
    try {Thread.sleep(100); } catch(Exception e) {}
    br_in.close();
    catch (IOException ioe) {
    System.out.println("Exception caught printing process output.");
    ioe.printStackTrace();
    finally {
    try {
    br_in.close();
    } catch (Exception ex) {}
    }).start();
    new Thread(new Runnable(){
    public void run() {
    BufferedReader br_err = null;
    try {
    br_err = new BufferedReader(new InputStreamReader(pr.getErrorStream()));
    String buff = null;
    while ((buff = br_err.readLine()) != null) {
    System.out.println("Process err :" + buff);
    try {Thread.sleep(100); } catch(Exception e) {}
    br_err.close();
    catch (IOException ioe) {
    System.out.println("Exception caught printing process error.");
    ioe.printStackTrace();
    finally {
    try {
    br_err.close();
    } catch (Exception ex) {}
    }).start();
    catch (Exception ex) {
    System.out.println(ex.getLocalizedMessage());
    public static boolean isWindows() {
    if (System.getProperty("os.name").toLowerCase().indexOf("windows") != -1)
    return true;
    else
    return false;
    ---PROCEDURE TO BE EXECUTED WHICH USES THE ABOVE JAVA CLASS IS ----
    CREATE OR REPLACE PROCEDURE Host_Command (p_command IN VARCHAR2)
    AS LANGUAGE JAVA
    NAME 'Host.executeCommand (java.lang.String)';
    --- THE PERMISSIONS ---
    call dbms_java.grant_permission('SYSTEM', 'SYS:java.io.FilePermission', '<<ALL FILES>>', 'read ,write, execute, delete');
    call dbms_java.grant_permission('SYSTEM', 'SYS:java.lang.RuntimePermission', 'writeFileDescriptor', '');
    call dbms_java.grant_permission('SYSTEM', 'SYS:java.lang.RuntimePermission', 'readFileDescriptor', '');
    --- THE SHELL SCRIPT IS -----
    #!/bin/sh
    # This script removes the carriage returns from the Files having .DAT1 extensions in the /test/ Directory
    # and the sends the single line stream to the new file with the use of 'gawk' command
    # so finaly the files with same primary name but different secondary name are created
    # e.g. file 'test.DAT1' is onverted to 'test.DAT'
    # LOOP on /test/ DIRECTORY FOR SEARCHING FILES HAVING EXTENSION *.DAT1
    for file_name in `ls /test/*.DAT1`
    do
    new_file_name=`echo $file_name | sed 's/DAT1/DAT/'`
    # SEND THE CONTAINTS OF SELECTED FILE IN LOOP AS A CONTINUOUS STREAM TO NEW FILE NAME USING 'gawk' COMMAND
    gawk 'BEGIN { ORS = "''" } { print $0 }' $file_name >> $new_file_name
    # ABOVE LINE WILL CREATE A NEW FILE WITH SAME PRIMARY NAME BUT .DAT AS SECONDARY NAME(EXTENSION)
    # REMOVE THE PRIOR FILE(s) AFTER SUCCESSFUL CALL TO 'gawk'
    # $? returns 0 if the call to gawk command is succesfull
    if test 0 = "$?"
         then
         rm -f $file_name
    fi
    done
    # END LOOP ON /test/ DIRECTORY
    ---THE CALL TO THE PROCEDURE --
    SQL>CALL DBMS_JAVA.SET_OUTPUT(1000000);
    SQL>SET SERVEROUTPUT ON SIZE 1000000
    SQL>exec host('/root/sh ecs_script.sh'); -----------------------------------------------1
    now, the statement 1 is the path of the Shell Script ecs_script.sh
    which uses gawk command and does some operations on some file..
    but when i give the call in Statement 1 its giving error like
    /bin/sh is not a directory
    so i am not getting wHat should I do so that my script "ecs_script.sh" gets executed..
    Please Help.

    @ Bhagat & Michaels
    Dear Friends,
    I changed my shell name as per ur suggestions
    and recompiled the Java class source with
    finalCommand[0] = "/bin/bash"; instead of finalCommand[0] = "/bin/sh";
    and then recompiled the host procedure
    executed the host procedure as per ur suggestion as follows (with out put)
    SQL> exec host('/bin/bash ecs_script.sh')
    PL/SQL procedure successfully completed.
    bt, bt, bt, it still did not do any operations defined in the "ecs_script.sh"
    in fact the script did nt executed.......
    pls help , I am loosing my time..
    regards.

  • Need help in Shell Scripts

    Hi,
    I have a requirement need a help.
    Requirement states like this:
    I need to write a shell script through which I need to search a huge lines code and to find out following information :
    1. Total No of lines of the code
    2. No of DML statements (select,update,insert, delete) used like how many SELECT, How many UPDATE etc used in it.
    3. No of base apps tables referenced like How many tables starting with "CMF_" is present.
    4. No of procedure calls like how many procedures starting with "PROC_" used.
    Can anyone help me in this ? I need to script.
    My Unix version is :
    $ uname -a
    SunOS appsnet 5.6 Generic_105181-21 sun4u sparc SUNW,Ultra-4
    Thanks in advance
    [email protected]

    What you need here is a AWK script. This script will read the input as the source file (as command line
    argument or as standard input), and process each like of the file read to look for the different patterns
    in that line (looking for example if the line contans "SELECT " or "INSERT " etc...) and increment its
    corresponding count. At the end of the script in the END section you can get the number of lines with the
    NR awk inbuilt variable.
    Hope this helps.
    Hi,
    I have a requirement need a help.
    Requirement states like this:
    I need to write a shell script through which I need to search a huge lines code and to find out following information :
    1. Total No of lines of the code
    2. No of DML statements (select,update,insert, delete) used like how many SELECT, How many UPDATE etc used in it.
    3. No of base apps tables referenced like How many tables starting with "CMF_" is present.
    4. No of procedure calls like how many procedures starting with "PROC_" used.
    Can anyone help me in this ? I need to script.
    My Unix version is :
    $ uname -a
    SunOS appsnet 5.6 Generic_105181-21 sun4u sparc SUNW,Ultra-4
    Thanks in advance
    [email protected]

  • Help regarding issue connecting to DB through shell script

    Hi,
    I have a Oracle 8.1.7 Database running on a AIX box. I am trying to truncate one table from within the shell script using here documents.
    Code section of my script -
    succ=`sqlplus -s ${USR} << EOF
    whenever sqlerror exit sql.sqlcode
    set feedback on
    Truncate table abc.xyz;
    exit;
    EOF`
    USR has been set as /. We have ops$ users in the database. So when I run this script using my id it runs fine. The problem seems to be coming when this runs as part of the batch job which runs under a different osuser. The error is -
    + + sqlplus -s /
    + 0< /tmp/sh164108.8
    succ=ERROR:
    ORA-01017: invalid username/password; logon denied
    SP2-0306: Invalid option.
    Usage: CONN[ECT] [logon] [AS {SYSDBA|SYSOPER}] | [INTERNAL]
    where <logon> ::= <username>[<password>][@<connect_string>] | /
    SP2-0306: Invalid option.
    Usage: CONN[ECT] [logon] [AS {SYSDBA|SYSOPER}] | [INTERNAL]
    where <logon> ::= <username>[<password>][@<connect_string>] | /
    SP2-0157: unable to CONNECT to ORACLE after 3 attempts, exiting SQL*Plus
    I am not sure what is going wrong. I have tried and googled for the issue and it seems that the issue is coming because the osuser under which the job runs may not be setup to use "sqlplus -s /" ? Any help appreciated.
    Regards,
    Saurabh

    This is the forum for Oracle's SQL Developer tool, not for general SQL and PL/SQL questions.Questions like this will get a better response in the PL/SQL forum.
    Having said that, it looks likely that the other user doesn't have an ops$ account.

  • Help with shell script

    Can anyone here help me (getting my feet wet) with an addition to a profile (applmgr) that I am trying to make - in the form of a shell script.
    I have the following lines in the profile file - but each time I log into the server as applmgr, I get the error following
    if $HOSTNAME=hostname1
    tnen
    . /u01/xxees/EBST/apps/apps_st/appl/APPSEBST_$HOST.env
    fi
    if $HOSTNAME=hostname2
    ./u01/xxees/EBST2/apps/apps_st/appl/APPSEBST_$HOST.env
    fi
    The error message I am getting us
    -bash: /local/ebsuser/applmgr/.profile: line 39: syntax error near unexpected token `fi'
    -bash: /local/ebsuser/applmgr/.profile: line 39: `fi'
    Thank you all.
    Edited by: 864641 on Jun 13, 2012 1:49 PM

    From the Error Message at line Number 38, I feel that, the file /u01/xxees/EBSTEST/apps/apps_st/appl/APPSEBST_$HOST.env (where $HOST can be "hostname01" or "hostname02") has been modified and has unmatched if.
    Also, If you are using the variable HOSTNAME, I feel that the env file should be like /u01/xxees/EBSTEST/apps/apps_st/appl/APPSEBST_$HOSTNAME.env in which case your script will be like:
    if [$HOSTNAME == "hostname01"]; then
    . /u01/xxees/EBSTEST/apps/apps_st/appl/APPSEBST_$HOSTNAME.env
    fi
    if [$HOSTNAME == "hostname02"]; then
    . /u01/xxees/EBSTEST2/apps/apps_st/appl/APPSEBST_$HOSTNAME.env
    fi
    Hope that this two things will help in resolving the issue.

  • Need help to find a good shell script to delete logs, tablespace check, etc

    Can you help me to find a good working shell script to run as a cron job to check tablesapce free space per thredhold and delete old trace files, .aud files, etc.
    Thanks,

    refer the links:-
    http://www.shutdownabort.com/dbaqueries/Structure_Tablespace.php
    http://gavinsoorma.com/unix-for-the-dba/
    Shell script to delete archive logs that are 10 days old.
    Re: How to delete archivelogs ???????
    http://kmit4u.blogspot.com/2010/10/shell-script-backup-oracle-database-by.html

Maybe you are looking for

  • What else to try? I've tried these steps to get Flash to work

    I'm running Vista Ultimate 32 bit, with IE9. I've had flash on my computer for years. Current version is 10.3.183.10. Yesterday it stopped working. Web pages are saying that I need to download Flash. Used your uninstall utility to remove what I had.

  • How can i delete old outdated emails from my ipad?

    Ipads and Iphones remember every email I have ever used.  Even if I make a typo or if I have deleted an old email.  There seems to be no way of deleting them.  Now I find that when I was in a hurry and sent an email to "Teresa"  the choices that come

  • Mac Mini 2011 Sleep of Death

    I have a Mac Mini 2011 with Lion factory installed configured with an original Apple Keyboard and a LG - HDMI monitor. If the Mini goes to sleep either manually using the Apple Menu or based on Settings , it does not wake up ! Any  subsequent attempt

  • Using an old WRT54G as a print server

    I have an old WRT54G wireless router that I would like to use as a print server or access point for an HP printer that is located in a downstairs office. it would only be the printer hooked up. I just want to be able to print from anywhere in the hou

  • HELP ME!! ADOBE FLASH PLAYER NOT WORKING

    I dont know what is happening... Actually i have just now adobe flash player 11 active x installed. I was not able to download it from the main site. So i tried a alternate link i found on the forum here. It is installed now but it doesnt work or lik