Create a simple shell script thing?

Hey,
I'm trying to make a simple command script thing. I have no idea what I'm doing though.
I just want a file that I can click and open in terminal that will:
1. ssh [email protected]
2. auto enter the password (if this is really complicated then it can be skipped)
3. cd public_html/blog
4. svn up
5. like 5 sec delayed exit (if possible)
I'm thinking this is a really easy thing to do for someone who knows what they're doing.
So can someone tell me what I have to do to make this? I would really like to learn how to do this.
Thank you
Last edited by FLCLFan (2008-10-12 20:06:20)

Instead of making a script, you could just as well write a bash function for this and put it in your .bashrc.
something like this:
update-svn-on-domain ()
ssh -t [email protected] 'svn up public_html/blog'
when the svn up is done, the ssh command stops, and the function returns.  it does everything you want except auto entering passwords. 
i strongly discourage auto entering passwords.  i recommend you to setup rsa key authentication

Similar Messages

  • Creating simple shell script packages to deploy with ARD and TaskServer

    I am looking for a simple step by step on how to create a package that can be deployed using ARD, to run a simple shell script like
    "softwareupdate -i -a"
    A brief search here returned nothing, but perhaps I was not using the correct terms.
    Ultimately, I want to use ARD to run software update on ~400 Macs.
    Thanks in advance for your help.
    Bill

    If I send it as a unix command, it will run only on machines that are currently awake and responding to ARD.
    If I can set it up as a package, then I can use Task Server to "deploy" the command to machines that are not currently online. When the machines next contact the Task Server, they will be told to run softwareupdate.

  • Running a simple shell script

    Not being a regular user of terminal on OSX, I have managed to forget how to run a simple shell script. The purpose of the script is to rename a set of files contained in a specific directory. Here is a sample of the script I wrote some time back:
    mv product_22.jpg 080688614423.jpg
    This command repeats for each file I need to rename. My recollection is that I simply put the actual script text file in the same directory as the images to be renamed and drag the script file into a new terminal window and hit enter to run. When I try this however I receive the following error:
    ord2: Permission denied
    Can anyone help me out here? I'm running 10.2.8. I seem to beforgetting a critical step somewhere along the way.
    Thanks
      Mac OS X (10.2.x)  

    Have you set the execution bit for the script? When not, use: chmod 755 script.

  • Simple Shell Script Question.... [java related]

    Hey guys! This is my first post, as im new here :S
    I have a simple problem for a big program.
    We have a .sh to install it, but when I run the .sh in terminal like i should, It says the class is not found. I believe it has to do with the syntax, as the person who made it is not a linux pro. I don't know MUCH about shell scripts, but I'm pretty sure I know where the error lies.
    Our Script:
    java -classpath ./:./jars/tools.jar:./jars/nexus.jar impsoft.nexus.installer.Install
    chmod a+x run.sh compile.sh
    The Error:
    Exception in thread "main" java.lang.NoClassDefFoundError: impsoft/nexus/installer/Install
    What I think the problem is:
    ./jars/nexus.jar impsoft.nexus.installer.Install
    Thank you for ALL of your help!

    Hi Justin,
    Have you tried running the lines from the command line?
    The second thing you may want to try is changing the relative directory for the jar file from a relative one to a fixed directory. From the error, it appears that the install program is running but it is not able to locate a library mentioned in the program (which is probably the jar file listed in the classpath).
    Hope that helps.
    J. Haynes
    Denver

  • How to create database using shell script

    hai
    how to create database using shell script

    The documentation details the steps to create a database manually. Another option is to use DBCA to create the scripts. DBCA will give you a complete set of scripts that will create a database.
    http://download-east.oracle.com/docs/cd/B19306_01/server.102/b14231/create.htm#sthref220

  • Simple shell script utility to copy abs tree for build

    Hi,
        I'm learning shell script and decided to make a simple script to copy the folder i want from /var/abs to
        a new folder so i can build the package. here it is: (remember, i'm new to shell scripting, if you know a better way to do it, you can modify my script
        and post here a better solution, so, i (and others) can learn with my errors)
    #!/bin/bash
    #Looks for the abs tree of the software you want
    #and copy it to your build path
    ABSTREE=/var/abs
    echo -n "What software do you want? "
    read absname
    result=$(find $ABSTREE -name $absname)
    for i in $result; do
    echo -n "$i, is this what you want? [y/n] "
    read opt
    if [ $opt = "y" ]; then
    echo -n "Copy to... "
    read buildpath
    relative=${i#$ABSTREE}
    absolute=$buildpath${relative%$absname}
    mkdir -p $absolute
    cp -r $i $absolute
    echo "$i successfully copied to $absolute"
    exit 0
    fi
    done
    exit 1

    spoonman wrote: mkdir -p $absolute
    cp -r $i $absolute
    echo "$i successfully copied to $absolute"
    You are assuming `mkdir` and `cp` were successful. You should test them to make sure, and exit with failure if not:
    mkdir -p $absolute || exit 1
    cp -r $i $absolute || exit 1
    echo "$i successfully copied to $absolute"
    You could also include your own error message, but mkdir and cp would throw their own if something fails...
    mkdir -p $absolute || { echo "mkdir failed"; exit 1; }
    cp -r $i $absolute || { echo "cp failed"; exit 1; }
    echo "$i successfully copied to $absolute"
    Another way is to use `set -e` which will exit the script on any failure without explicit testing:
    set -e
    mkdir -p $absolute
    cp -r $i $absolute
    set +e
    echo "$i successfully copied to $absolute"

  • Simple shell script issue

    Hi,
    I have an issue with following shell script:
    #!/bin/sh
    env | while read VAR; do
    RIGA=$RIGA"\""$VAR"\";"
    done
    echo $VAR
    echo $RIGA
    exit 0
    Why the last echo commands (echo $VAR and echo $RIGA) don't give me any result? Why $VAR and $RIGA are empty?

    From what I understand, anything to the right of a pipe is run in a sub-process in non POSIX shells, which runs in it's own environment. Variables changed inside ta sub-shell are not changed at the parent process.
    Perhaps using ksh instead of bourne shell will work, or you could try input redirection rather than using pipe command. e.g.:
    while read VAR; do
    RIGA=$RIGA"\""$VAR"\";"
    done < $(env)
    echo $VAR
    echo $RIGA
    exit 0
    Edited by: Dude on Dec 15, 2010 6:11 AM

  • How to use the result of simple shell script?

    The shell script below retrieves the length of an audio file:
    set aFile to choose file
    do shell script "afinfo " & quoted form of (POSIX path of aFile) & "|grep duration"
    I'm wondering, how can I copy the result to the clipboard or set the value of a variable to it?
    Total newbie question. I have no idea about shell scripts - I just found the script above online.
    Thank you so much!

    Here:
    set the clipboard to (do shell script "afinfo " & quoted form of (POSIX path of aFile) & "|grep duration")
    or:
    set A to do shell script "afinfo " & quoted form of (POSIX path of aFile) & "|grep duration"
    (53997)

  • Simple shell script problem...

    I am trying to get a list of directories on a remote machine, compare them with the directories on the local machine and copy any that dont match on the local machine to a backup folder. Heres my code but i am a newbie and i cant get my shell script to read from a file. The for loop never executes so i am guessing i am not reading the file correctly - see below.
    #!/bin/ksh
    ssh -l removeserver 192.168.xxx.xxx ls /remote/server/directory/ > /store/remote/directory/listing/motapp1files.txt
    newfile=''
    $newfile < /store/remote/directory/listing/motapp1files.txt
    for file in $newfile;
    do echo $file
    if [ ! -d local/machine/directories/$file/ ]; then
    echo "this folder doesnt exist on on remote server "; echo $file;
    fi
    done

    Re-inventing the wheel perhaps. Look into rsync. Great program!
    I used it in FreeBSD to do a very similar task.

  • Simple shell script to create linkedClones on stand alone ESXi host.

    Hey Guys,
    Last few days I have been working on creating linkedClones in bulk for some of the testing purpose. Since I did not had my vCenter up and running so I spend few minutes to write a simple script to create a linkClones on standalone ESX host.
    My script create full clone of given VM, then creates snapshot on it and starts creating linkedClones from the delta vmdk files (it just create new directory for linkedClone VM's and copies those delta files to new location and then point it to base disk, nothing magic here ).
    Now this script is working perfectly fine for me, and I can power on all the VM's which is pointing to base disk. Later I tried creating linkedClones using vCenter API's as well which seems to be doing the similar thing.
    So I just want to check with you guys if my script is Ok or thats not the way to do it (this may be unsupported way of creating linkedClones but I just want a way to create linkedClones on standalone esxi host as I may not have vCenter server available everytime) ?

    Hi!
    As long as your softsynths comes in the VSTi format (most of them do now), you can insert it on a track in Audition, which has 'host' capabilities from V3.
    In the Multitrack, insert a new MIDI track from the 'Insert' menu (note: MIDI Track, not just 'MIDI').
    On that track pane hit the 'Sequencer' button, and it will open in a separate window. In the pane left of the keyboard you can insert your VSTi of choice, and make your MIDI connections.
    Back on the Main track pane, engage the 'L' button for Live monitoring. Actual recording (of MIDI) is done in the Sequencer window.
    The usual, and recommended workflow is to keep the MIDI tracks 'open', i.e. you can edit the sound in your instrument and even the notes played at any time in the process, compiling the actual audio as the last step in the mixing.
    If you kind of 'insist' on doing it the old way, you can export the audio from your recorded MIDI+VSTi creations track by track like this: Leave the Sequencer window open, make a selection in the multitrack that covers the time span you have played. Solo the track (will mute all others), and use File / Export Audio Mixdown. Use 'Master' as the source. This will give you a wave rendering of what's currently in the MIDI sequencer. Qualitywise this is better since it's all internal and digital instead of in/out of soundcards with DA/AD conversion etc.
    I haven't found a method for a 'live' wave recording while you play, but there may be one...
    If you purchase Audition it comes with Help files explaining this in more/better detail. ;)

  • Simple Shell Script To Add To Default Path?

    I know that this question will at first appear idiotic,but here goes.
    I'm logged into a Solaris 9 shell as 'root'. I echo $PATH and see a couple of default paths. I want to add to that PATH - this can easily be done from the command line as follows:
    PATH=$PATH:/some/other/path
    export PATH
    So, naturally, I'd like to throw this into a simple script, and when I do so, and run the script called 'hello'. So, I run 'hello' as follows:
    ksh hello (I'm a kshell)
    Result: no errors. Then, I check my PATH as follows:
    echo $PATH
    And nothing changes, it's still the same PATH!
    Can anyone tell me how to do this?
    Appreciate your response.
    dedham_ma_man

    The question shows you don't really understand how shells work.
    The path is part of the environment of your current shell.
    Any command you "execute" is run in a new process. And any changes made to the environment of that process cannot effect the environment of the parent process (ie your shell).
    So by saying "ksh hello" your starting a new shell and changing the path in that shell. But when that shells exits and your back in the original shell, of course nothing has changed.
    So the answer is that what you have to do is not "run" the script. But persuade your current shell to execute in its own context.
    In a C shell that would be done by the "source" command. And in a bourne shell, its the "." command. But I'm not sure how you do it in korn shell.

  • [SOLVED] Simple Shell Scripting Question - Echo and Execute?

    I've got a bash script which has many different commands it executes in a row. Each time the script executes one of the commands, it outputs what it is doing to the screen:
    echo "cp -r home new"
    cp -r home new
    echo "mv testfile new/."
    mv testfile new/.
    I am just wondering if there is a function to execute a command and output it at the same time. Something like...
    echoandexecute("cp -r home new")
    echoandexecute("mv testfile new/.")
    Last edited by tony5429 (2008-08-27 19:59:04)

    Otherwise you can define it yourself:
    echoandexecute() {
    echo $1
    $1
    echoandexecute "cp -r home new"
    Last edited by catwell (2008-08-27 20:57:16)

  • 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)

  • Simple Pekwm Categorized Menu Populator (Shell Script)

    I wanted to share this script I wrote in the hope that it will prove to be as convenient to some of you as it has been to me.
    Suggestions and modifications are welcome.
    #! /bin/sh
    #USING WITH PEKWM
    # -Install this file to ~/.pekwm/scripts/menugen.sh
    # -Add this line to ~/.pekwm/start:
    # ~/.pekwm/scripts/menugen.sh > ~/.pekwm/dynamic
    # -Add this line where desired to the RootMenu section of ~/.pekwm/menu:
    # INCLUDE = "dynamic"
    # -Reload Pekwm
    # -Restart Pekwm
    #This will allow the menu to regenerate each time Pekwm restarts.
    #MAKING ADJUSTMENTS
    #Select a list of categories into which you would like your applications to be sorted, then add them to the "CATS=..." line below separated by spaces.
    #Some common values are:
    # CATEGORY DESCRIPTION
    # AudioVideo Application for presenting, creating, or processing multimedia (audio/video)
    # Audio An audio application Desktop entry must include AudioVideo as well
    # Video A video application Desktop entry must include AudioVideo as well
    # Development An application for development
    # Education Educational software
    # Game A game
    # Graphics Application for viewing, creating, or processing graphics
    # Network Network application such as a web browser
    # Office An office type application
    # Science Scientific software
    # Settings Settings applications Entries may appear in a separate menu or as part of a "Control Center"
    # System System application, "System Tools" such as say a log viewer or network monitor
    # Utility Small utility application, "Accessories"
    #For a better idea of how your applications may be categorized, you may also want to inspect the contents of the "Categories=" line of the various *.desktop files under /usr/share/desktop/
    CATS="Audio Graphics Network Settings System Utility"
    for CAT in $CATS; do
    echo " Submenu = \"$CAT\" {"
    for CATMATCH in `grep -l "^Categories=.*$CAT.*" /usr/share/applications/*.desktop`; do
    name=`sed -n '1,/^Name=/ s/^Name=//p' <$CATMATCH`
    exec=`sed -n '1,/^Exec=/ s/^Exec=//p' <$CATMATCH`
    echo " Entry = \"$name\" { Actions = \"Exec ${exec% %[UuFf]}\" }"
    done
    echo " }"
    done

    No matter how you chose to do it it's going to be a bit more work than a simple shell script. There are a lot of choices though.
    Objective-C/Cocoa (this is how most of the big boys do it)
    http://developer.apple.com/documentation/Cocoa/Conceptual/ObjCTutorial/01Introdu ction/chapter1_section1.html
    AppleScript Studio
    http://developer.apple.com/documentation/applescript/conceptual/studiobuildingap ps/chapter01/chapter1_section1.html
    Python/Cocoa bridge
    http://developer.apple.com/cocoa/pyobjc.html
    There are more options if none of these appeal to you.
    Eric

  • Process Flow - Executing a shell Script

    I have a simple shell script being called at the start of a process flow, up until a few days ago this worked fine across DEV, TEST and PROD.
    It's now stopped working in PROD.
    It executes through the command line fine as an os user and when you inspect:
    select * from all_rt_audit_executions where execution_name like '%SCRIPT_ONLY%' order by updated_on desc;
    The return_result is OK, but the script has not executed (it creates a simple file and I have added another one at the end of the script 'id >> whoami.txt')
    I've no idea what the sysadmin has been up to so can't comment on configuration changes on the box.
    Any ideas?
    Edited by: RodCouncil on Mar 16, 2009 4:51 PM

    First off, if the admin has upgraded or re-installed the repository, it might have reset back to the default security properties
    The properties file is found in $OWB_HOME/owb/bin/admin/Runtime.properties and change the following parameters to NATIVE_JAVA :
    property.RuntimePlatform.0.NativeExecution.FTP.security_constraint = NATIVE_JAVA
    property.RuntimePlatform.0.NativeExecution.Shell.security_constraint = NATIVE_JAVA
    property.RuntimePlatform.0.NativeExecution.SQLPlus.security_constraint = NATIVE_JAVA
    Make sure that there are no trailing spaces on the line after NATIVE_JAVA.
    Also, if they have upgraded software could they have changed the detault UNIX profie so that you are no longer finding executables? Or changed around the file structure so that your script is in a different absolute location so that OWB doesn't find it anymore? Or changed up directory permissions so that the Oracle user can't see the script anymore?
    Just a few thoughts on things to check for....
    I'd ask your sysadmin to check the OWB security profile, and then to try running the script from the Oracle Unix account and let you know the results (assuming that you do not have access to the Oracle user).
    Edited by: zeppo on Mar 16, 2009 10:40 AM

Maybe you are looking for