Automator hanging running sudo???

I have an older server we just upgraded to 10.7.  I had some automator scripts I ran to change permissions.  I opened them to update them and it hangs on the Run Applescipts that have a sudo command in them.  They just hang and never stop.  I even created this simple script to run cd and it hangs.  Yesy in my actual script the password is correct.  Any ideas?
Thanks,
Scott
on run {input, parameters}
          do shell script "sudo cd" password "test" with administrator privileges
          return input
end run

figured it out

Similar Messages

  • How to create script that run sudo-command, via automator?

    Hi
    I'd want to create script to automate one command I need quite often. I just can't get this to work.
    I'm not using english OS, but I think this is what I do. In automator I choose Utilities -> Run script
    Here's the script I try to run:
    sudo "/Library/Application Support/VMware Fusion/boot.sh --restart"
    I found some tip to do it like this:
    do shell script "sudo /Library/Application Support/VMware Fusion/boot.sh --restart password "pass" with administrator privileges
    Where pass is my admin password.
    This does not work, either.
    Could anybody help me on this?
    Thanks...
    Tomi Toivonen
    Message was edited by: Tomi

    This is not working. What's wrong?
    What's wrong is that the '--restart' is a parameter for boot.sh, and therefore needs to be included within the quotes.
    Additionally, the shell uses spaces to divide parameters, so the spaces in the command will make it appear as multiple commands - '/Library/Application', 'Support/VMware' and 'Fusion/boot.sh'. You need to escape them using a backslash:
    <pre class=command>do shell script "/Library/Application\ Support/VMware\ Fusion/boot.sh --restart" password "pass" with administrator privileges</pre>
    If it's outside of the quotes it would be interpreted as a parameter to 'do shell script' and it won't know what to do with that.

  • Sudo: sorry, you must have a tty to run sudo

    Hi Guys,
    When I install the 12C management agent using upgrade console one step " RunRootScript" failed with below error.
    sudo: sorry, you must have a tty to run sudo
    But the status of job "PreDeployAgentSW" is successul.
    Can someone tell me how to fix this.
    Can I run the root.sh scripts manually.
    What are the scripts that I should run .. If I have to run the scripts manually.
    Thanks,
    Silver
    Edited by: Erin.Silver on Apr 2, 2013 3:55 AM

    Are you trying to deploy a fresh 12.1.0.x agent from add host wizard (agent push) in EM console OR you are upgrading your existing em 12.1.0.1 agent to 12.1.0.2 using agent upgrade console in EM console ?
    a) If you are doing a fresh install of 12.1.0.1 agent then look at the sudo requirement from the pre-req section:
    You might have to comment out Defaults requiretty in the /etc/sudoers file ( this is fixed in em 12.1.0.2 )
    b) If you are doing agent upgrade then make sure that agent upgrade job is successful and see details here: http://docs.oracle.com/cd/E24628_01/upgrade.121/e22625/upgrading_12101_PS1_agents.htm#CIHCEEIB
    If you upgrade a Management Agent as a user who does not have root privileges, or you upgrade a Management Agent without having preferred privileged credentials, a warning appears. You can ignore this warning during the upgrade. Later, you can log in to the Management Agent host as the root user, and run the $<AGENT_BASE_DIR>/core/12.1.0.2.0/root.sh script. After running this script, ensure that you also run the $<AGENT_BASE_DIR>/core/12.1.0.2.0/replacebins.sh script on the host.
    This is also explained in the guide : http://docs.oracle.com/cd/E24628_01/upgrade.121/e22625/upgrading_12101_PS1_agents.htm#CIHCEEIB

  • How can I get Automator to run every hour

    Hello,
    I want to run a Unix Shell executable every hour (measuring network bandwidth), but automator only seems to be able to go down to once  a day. Is there anyway of getting automator to run the executable every hour?

    If you already have the shell script then skip Automator and use launchd(8)  to run the script on what ever schedule you'd like.
    There are many good tutorials and examples of using launchd  see Creating Launch Daemons and Agents - Apple Developer and Mac OS X launchd examples  for a start.
    Also see http://launched.zerowidth.com/ as one way to automate making the plist file.
    regards

  • How to create a one click apple script to run sudo rm -rf in terminal

    Hey Everyone
    I have sensitive information on my computer, quite paranoid and would love to have a one click script to run sudo rm -rf in terminal.
    I'm quite new to scripts and all that, can someone please explain how to do this as a noob?
    would love if I didn't need to enter the password to authorise the wipe.
    also is there anything more effective as sudo rm -rf?
    and can sudo rm -rf be undone? like can some traces be brought back from the drive if your like a super pro at hard drive data recovery?

    Welcome to Apple Support Communities
    That's not the way to delete everything from the hard drive, because your files can still be recoverable after running that command with special apps.
    Instead, if you want to make sure that your data cannot be recovered, start up in OS X Recovery (hold Command and R keys while your Mac is starting up), open Disk Utility and erase your OS X partition by choosing one of the security options you can use to erase your files. See > http://pondini.org/OSX/DU2.html
    A better option would be to put that sensitive data onto an encrypted external drive

  • How to prevent Automator's "run shell script" to create fully decomposed forms of my strings ?

    I am using Automator's "run shell script" and I am seeing that it outputs fully decomposed forms of my strings.
    For example, when I set the action to "echo été" in a service (with "Replace selected text" activated) and run that into a Textwrangler window, I'll get fully decomposed forms that Textwrangler won't understand. But when I simply type that command into Terminal, I get my string in composed form.
    The problem is not the display issue, but the fact that if I want to run grep for example in "run shell script", I will not be able to find the proper strings since the forms are different.

    Originally I was using $@ to parse a string and get the result pasted by the service. That was a while ago. There, I noticed that some Japanese characters were messed up. Basically all the kana characters that come with voicing markers like が-ga (instead of か-ka) etc. I did not have the time to pursue that issue though.
    Then, last night, I found that a colleague of mine had tried to use $@ to feed to a local dictionary application called ding (http://ftp.tu-chemnitz.de/pub/Local/urz/ding/). His problem was with characters that had umlauts. After verifying how he wrote his action I remembered that I had similar issues with Japanese.
    Basically his command was "/path/to/ding $@"
    That's supposed to use the selected string as an argument to pass to ding, which will launch a Wish application where the string is used as the searched item.
    From Terminal, that works a treat. But the exact same line in Automator (with input as argument, not as stdin) messed the composition and the resulting string was not recognized by ding as a match to what it was supposed to match.
    So, I tried a few things to get to the core of the issue and found that a simple "echo [accented characters]" was enough to reproduce the difference in string handling between Automator and Terminal. That difference is also reproduced on a number of person's machines.
    I have a number of services that basically revolve on "run shell script" actions and involve 3rd party application outputs, preference files etc. so it would not be convenient to show that to you.
    I have sent a mail about this issue to the automator list yesterday too:
    http://lists.apple.com/archives/Automator-users/2011/Jun/msg00004.html

  • Can't empty trash in OSX10.6.8. Used Trashit unsucessfully. If I run sudo rm -ri ~/.Trash, terminal crashes

    Can't empty trash in OSX10.6.8. Used Trashit unsucessfully. If I run sudo rm -ri ~/.Trash, terminal crashes. PowerMac G-5

    This should do the job without all the Ys. BUT you must be 100% certain you have entered the command EXACTLY as written below. One typo and you could lose all the data in your user. Copy/paste only and TRIPLE check it's entered properly in Terminal. The -f option, instead of the -i option will force empty and delete immediately. No questions. (rm is remove/delete, -r is everything inside the folder, -f is force, no questions)
    sudo rm -rf ~/.Trash
    There is a single space between sudo and rm
                                               "          rm and -rf
                                               "        -rf and ~/.Trash
    NO SPACES IN  ~/.Trash
    It may take a while, depending on how many items are being deleted. You'll know it's done when you get a new $ sign prompt.

  • Automator to run on its own

    Is there a way to tell automator to "Run" the script with out me having to click "Run"? I basically just want automator to open the script, run the script, and close by itself. I have figured out how to do all but tell it to run on its own. Thank you in advance
    Andrew

    What I have done is this:
    Created a script to copy three folders on my desktop to my idisk drive and then it will automatically close Automator.
    I placed the script in my startup items so it will run daily. The only thing I am having issues with is that when the script loads I have to click "Run" for the script to run. What I was wondering if there is a way for the script to just run on its own when it is lunched. Here is my overall goal of what it should do without me having to do anything.
    1. OSX opens script during log on. (Solved)
    2. Automator runs script on its won. (Unsolved)
    3. Automator closes script. (Solved)

  • Create app to run Sudo rm command

    I would like to develop a simple application that runs the sudo rm command. I would like the interface to be a simple drag-and-drop window and an execute button. I have xcode but im not familiar with how to use it. I have also heard that people can use automator to create apps.
    Any help is appreciated, and i have an email if more regular correspondence is needed. Thanks in advance!
    Kenny

    X Windows Manager provides an interface to render the windows and basic widgets on screen, see http://en.wikipedia.org/wiki/X_Window_System.
    LabVIEW for Linux has in principle a rather hard dependency on some form of Windows manager being present. During startup of LabVIEW this X Window manager is initialized and if it isn't present all kind of havoc can occur.
    I think there was some semi documented INI file setting that one could use to allow a LabVIEW app to start up even if no X Window manager was installed but that had its own difficulties. In my experience it wasn't really worth the hassles. The easier solution was usually to install a minimal X Window server such as a text only variant so that the dependency was properly satisfied and LabVIEW could initialize everything properly, eventhough no user interface was later displayed in the LabVIEW app.
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • How to run "sudo chmod" Folder Action?

    My MacPro has a dedicated drive for photos taken by myself and my wife on our respective iPhones. However when I download photos from my iPhone then my wife cannot access them due to limited privileges. The solution is to chmod the files to 755. So I made a Folder Action with the following Run Shell Script
    chmod -R 755 /Volumes/DATA/Camera\ Pictures
    It works on my photos however it does not work on the photos that my wife uploads to the shared drive since I am not the owner of her iPhone photos. So I need to run the sudo command however I am unable to code an Automator Folder Action to accomplish this because it results in error with or without the sudo command in front of the chmod command. Could somebody assist?

    I appreciate your assistance Niel. Here is my Run Applescript text:
    on run {input, parameters}
      do shell script "chmod -R 755 '/Volumes/DATA/Camera\ Pictures/PHOTO\ VAULT/Photos\ per\ annum '" with administrator privileges
      return input
    end run
    I included the full path this time. I receive Syntax Error [Expected """ but found unknown token].

  • Applescript for running sudo commands in terminal

    I'm a newbie when it comes to Applescript and was wondering if someone could help with a basic request. I need to write a small script to do the following:
    1. Launch terminal
    2. Run the 'Sudo -s' command
    3. Enter the administrator password (in plain text)
    and then
    4. run some sudo commands like "sudo defaults write /Library/Preferences/com.apple.loginwindow HiddenUsersList -array-add administrator"
    I actually WANT the administrator password to be in the script in plain text even though I understand the security risks (I will literally be the only person to ever see the script). I've trawled forums all over but can't seem to find what I am looking for and cannot get it working by patching together the various commands I have found. Thanks in advance for any help you can give!
    Sean

    I've included two examples.  The preferred way & the hacker way.
    with administrator
    It is easier to diagnose problems with debug information. I suggest adding log statements to your script to see what is going on.  Here is an example.
        Author: rccharles
        For testing, run in the Script Editor.
          1) Click on the Event Log tab to see the output from the log statement
          2) Click on Run
        For running shell commands see:
        http://developer.apple.com/mac/library/technotes/tn2002/tn2065.html
    on run
        -- Write a message into the event log.
        log "  --- Starting on " & ((current date) as string) & " --- "
        --  debug lines
        set unixDesktopPath to POSIX path of "/System/Library/User Template/"
        log "unixDesktopPath = " & unixDesktopPath
        set quotedUnixDesktopPath to quoted form of unixDesktopPath
        log "quoted form is " & quotedUnixDesktopPath
        try
            set fromUnix to do shell script "sudo ls -l  " & quotedUnixDesktopPath with administrator privileges
            display dialog "ls -l of " & quotedUnixDesktopPath & return & fromUnix
        on error errMsg
            log "ls -l error..." & errMsg
        end try
    end run
    This version has an inline password.
    Notice the echo 'password' |
    The single quotes are no accident.
    It is easier to diagnose problems with debug information. I suggest adding log statements to your script to see what is going on.  Here is an example.
        Author: rccharles
        For testing, run in the Script Editor.
          1) Click on the Event Log tab to see the output from the log statement
          2) Click on Run
        For running shell commands see:
        http://developer.apple.com/mac/library/technotes/tn2002/tn2065.html
    on run
        -- Write a message into the event log.
        log "  --- Starting on " & ((current date) as string) & " --- "
        --  debug lines
        set unixDesktopPath to POSIX path of "/System/Library/User Template/"
        log "unixDesktopPath = " & unixDesktopPath
        set quotedUnixDesktopPath to quoted form of unixDesktopPath
        log "quoted form is " & quotedUnixDesktopPath
        try
            set fromUnix to do shell script "echo 'password' | sudo ls -l  " & quotedUnixDesktopPath
            display dialog "ls -l of " & quotedUnixDesktopPath & return & fromUnix
        on error errMsg
            log "ls -l error..." & errMsg
        end try
    end run

  • How do I make an automator sequence run when I close an application?

    I have searched all over google, youtube, and the discussion boards but no one seems to want to do what I'm trying to do.
    I want to run a folder action every time I close out an application that imports files while its running. My actions then take those files, move them and create a symlink back to the original location so that next time the app runs, it sees the files like they never moved. I've tried 2 different ideas with varying acceptability.
    1. Create a folder action to watch the folder to copy. It got glitchy outside of Automator. I would be okay with this option but it has been acting up.
    2. Use the launching of the app to trigger the copying and moving etc. I can make the app icon the icon for my application that includes the moving and creating of the symlink. But it only does the saving when I open the app. So while I'm working on the files, they're not backed up to place until I close the app and reopen it next time.
    The catch: the file folder that I want to move files from and create symlink back to is my iMovie Library.
    Can anyone give me some ideas about how to work this right? Thank you!
    Running Mac OS X Mavericks 10.9.5  2.5 GHz Intel Core i5 8GB Ram and 1600 MHz DDR3

    Use some Applescript to launch your app, then wait until the app quits.
    When you do uit the app, the Applescript will continue then run the folder action.
    Activate "your app name here"
    repeat
         If application "your app name here" is not running then exit repeat
         Delay 10
    end repeat
    run folder action

  • System hangs running Server Backup - Windows Server 2012 R2 Essentials

    I ran through the Backup Wizard, selected the System, OS, and my Data drives to backup. total output is probably about 400-500GB of data to be snapshot and backed up. It's set to automatically backup daily at 9:00pm, but upon the first backup it just sits
    there. I figured I'd let it ride until the next day since I've seen backups take a couple hours before.
    Well, It's more than 12 hours since it started the process, and I cannot access my server. It doesn't wake the screen, CTRL-Alt-Del doesn't do anything, and I can't remote in with RDP.
    Any advice? I haven't shut it down or forced a reboot yet. 

    The server hangs when the backup starts, and I cannot see any error message other than after I hard reboot and see the error popup on reboot due to unscheduled shut down. Also, there is an error log in the Windows\Logs\WindowsServerBackup directory. The
    log files are empty, though. They are named according to date. 
    e.g. "Backup_Error-07-01-2014_02-00-06"
    I have reboot the system and the same happens when I try to backup again. I do have data in the backup HDD, as I have since disabled Server Backup. After disabling server backup, the designated drive is now mounted and I can see the log file created in the
    only backup folder on it.
    "Backup of volume C: has failed. The operation failed due to a device error encountered with either the source or the destination. If the source or destination volume is on a disk, run CHKDSK /R on the source or destination volume, and
    then retry the operation."
    "Backup of volume D: has failed. Server execution failed"
    All drives are new, and CHKDSK /R doesn't resolve anything in terms of allowing backup to proceed.
    I should also note that the C: HDD is a 512GB SSD with only 36GB of data on it including the OS. D: is a 2TB HDD with only 18GB of data on it. SQL server is active during the backup process, but even ending the SQL processes doesn't change the backup outcome.
    Server Backup ends up hanging regardless of everything I've tried.
    I imagine Server Backup would kill any processes that may prevent it from accessing data to snapshot/backup, no?
    I will add the backup HDD does have 3 files in the F:\WindowsImageBackup\NESServer\Backup 2014-01-07 020006 directory.
    @ 9:02pm 1/6/2014 (9:00pm was the scheduled start), a 2,550,784KB file
    @ 12:45am 1/7/2014, a 11,264KB file
    @ 10:49am 1/7/2014, a 272,384KB file
    All three of those files were created from the same backup process. However, checking the Server Manager/Server Backup Tool, that drive doesn't qualify as containing any backup files. "The backup location does not contain any backup. Specify another
    backup location."

  • Assert error/hangs running the performance sample code

    Hi,
    I'm doing some work to understand how fast I can expect Berkeley DB to run and I found the 2006 white paper on [Performance Metrics and Benchmarks|http://www.oracle.com/technology/products/berkeley-db/pdf/berkeley-db-perf.pdf] so I downloaded the [sample code|http://www.oracle.com/technology/products/berkeley-db/files/perf.zip] and made a couple of fixes to make it run with 4.7.25 (shown at the end).
    When I run 'make test' it frequently hangs on the "Transactional Data Store (write, in-memory logging)" test under OS X 10.5.7 and under Debian lenny (kernel 2.6.26-1-amd64).
    If I rebuild BDB with --enable-diagnostic I get this assertion error.
    jmeredith@op:~/src/perf$ rm -rf TESTDIR ; ./t
    Using Berkeley DB 4.7.25 - ops: 1000000; keysize: 8; datasize: 32
    Data Store (read):
    elapsed time: 0.392573 seconds : 2.5473e+06 key/data pairs per sec
    Data Store (bulk read):
    elapsed time: 1.615233 seconds : 2.66339e+07 key/data pairs per sec
    Data Store (write):
    elapsed time: 0.629771 seconds : 1.58788e+06 key/data pairs per sec
    Transactional Data Store (read):
    elapsed time: 2.413665 seconds : 414308 key/data pairs per sec
    assert failure: ../dist/../txn/txn_region.c/451: "td->mvcc_ref > 0"
    [0x4f431d]
    [0x4f41a9]
    [0x44cdff]
    [0x4f2e1e]
    [0x42f0d3]
    [0x4f3faf]
    [0x4fddee]
    [0x4f8dde]
    [0x4d975c]
    [0x4c9991]
    [0x4e417d]
    [0x40137c]
    [0x40198e]
    [0x52613b]
    [0x4001b9]
    Aborted (core dumped)
    Here are the changes to get the code to build.
    --- perf/t.c 2006-06-28 17:15:47.000000000 -0600
    +++ perf-fixed/t.c 2009-07-06 09:44:43.000000000 -0600
    @@ -1,4 +1,5 @@
    #include <sys/types.h>
    +#include <sys/time.h>
    #include <stdio.h>
    #include <stdlib.h>
    @@ -38,7 +39,15 @@
    char *progname;
    -extern void __os_clock(DB_ENV *, u_int32_t *, u_int32_t *);
    +void
    +__os_clock(DB_ENV e, u_int32_t secs_ptr, u_int32_t *usecs_ptr)
    +{
    + struct timeval t;
    +
    + gettimeofday(&t, NULL);
    + *secs_ptr = (u_int32_t) t.tv_sec;
    + *usecs_ptr = (u_int32_t) t.tv_usec;
    +}
    void cleanup(void);
    void op_ds(u_int, int);
    @@ -364,7 +373,7 @@
    op_tds(ops, 0, 0);
    res("Transactional Data Store (read):", ops);
    - op_tds(ops, 1, DB_LOG_INMEMORY);
    + op_tds(ops, 1, DB_LOG_IN_MEMORY);
    res("Transactional Data Store (write, in-memory logging):", ops);
    op_tds(ops, 1, DB_TXN_NOSYNC);

    Hi,
    I reproduced your problem on Ubuntu 4.2.3 with db 4.7.25 and saw the same assert error as you. From the error message, the program asserts error/hangs at the "Transactional Data Store (write, in-memory logging)", that is calling op_tds() with DB_LOG_IN_MEMORY as the flags.
    The problem comes from your change on the sample code that the DB_LOG_IN_MEMORY is set with wrong API. The DB_LOG_IN_MEMORY should be set in DB_ENV->log_set_config(). Please refer to [DB_ENV->log_set_config|http://www.oracle.com/technology/documentation/berkeley-db/db/api_c/env_log_set_config.html] and its flag DB_LOG_IN_MEMORY.
    I change env's setting flags in op_tds() as follows. In this way, the error I saw is eliminated and the program works as expected.
    The original code is:
    PERF_CHECK(
            dbenv->set_flags(dbenv, DB_AUTO_COMMIT | txn_flags, 1) == 0);"
    {code}
    I change it to:
    {code}
    if (txn_flags == DB_LOG_IN_MEMORY) {
            PERF_CHECK(
               dbenv->log_set_config(dbenv, DB_LOG_IN_MEMORY, 1) == 0);
            txn_flags = 0;
    PERF_CHECK(
            dbenv->set_flags(dbenv, DB_AUTO_COMMIT | txn_flags, 1) == 0);
    {code}
    Please apply the change and l*et us know if it works on your machine.
    Regards,
    Emily Fu, Oracle Berkeley DB                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • How to run sudo remotely for adding workload with local /etc/vdb

    Hi Henk
    My controller and slaves are all ubuntu. When I would like to add raw disk I/O workload against remote local /etc/vdb, it's error out and said no permission.
    I try to either change user=root or run command with sudo. it doesn't like pass through to remote ( ubuntu might be not allow to log in as root without password )
    Any suggest regarding this scenario ?
    Johnny
    parmfile
    host=default,user=ubuntu,shell=ssh,vdbench=/home/ubuntu/vdbench
    *hd=localhost
    *hd=fio-drive-1,system=192.168.2.74
    hd=fio-drive-2,system=192.168.2.75
    *hd=fio-drive-3,system=192.168.2.76
    *hd=fio-drive-5,system=192.168.2.78
    sd=sd1,lun=/dev/vdb,openflags=o_direct,threads=200
    *sd=sd1,lun=/home/ubuntu/vdbench_installer/TEST/test,threads=20
    wd=wd1,sd=sd1,xf=1k,rdpct=50
    rd=rd1,wd=wd1,iorate=100,elapsed=5,interval=1
    error message
    Vdbench distribution: vdbench50402
    For documentation, see 'vdbench.pdf'.
    20:21:21.627 input argument scanned: '-fparmfs'
    20:21:21.636
    20:21:21.636 Specifying 'host=(xxx.yyy.com,host_x) has been deprecated.
    20:21:21.636 Please specify 'hd=host_x,system=xxx.yyy.com' instead.
    20:21:21.636 Vdbench will honor this parameter until the next release.
    20:21:21.636
    20:21:21.699 Starting slave: ssh 192.168.2.75 -l ubuntu /home/ubuntu/vdbench/vdbench SlaveJvm -m 192.168.2.5 -n 192.168.2.75-10-150318-20.21.21.598 -l fio-drive-2-0 -p 5570
    20:21:22.255 All slaves are now connected
    20:21:22.372 Raw device 'sd=sd1,lun=/dev/vdb' does not exist, or no permissions.
    20:21:22.372
    20:21:22.372 Please check above failures
    20:21:22.372
    java.lang.RuntimeException: Please check above failures
            at Vdb.common.failure(common.java:306)
            at Vdb.InfoFromHost.matchDataWithSds(InfoFromHost.java:679)
            at Vdb.InfoFromHost.receiveInfoFromHost(InfoFromHost.java:496)
            at Vdb.SlaveOnMaster.processSlave(SlaveOnMaster.java:154)
            at Vdb.SlaveOnMaster.run(SlaveOnMaster.java:42)

    here are the steps I try, I can generate the raw diso I/O  on remote ubuntu now.
    #sudo visudo
    add
    user ALL=NOPASSWD: /home/user/vdbench/vdbench -f parmfile
    at the last line
    ctrl-X + enter for exit
    thanks
    Johnny

Maybe you are looking for