This should be a simple AFP script..but no..

Ultimately I'm trying to write this script to turn AFP on when it suddenly shuts off. However, I thought I would start easy and just use an echo command for the then statement.
Anyway, if I use the spaces by the "=" in the "if" statement, then the script just exits and does nothing. However, if i take the spaces out, the script always does the then statement, regardless if the "if" part is true or not.
So what am I doing wrong?
#!/bin/sh
if [ ps cx | grep AppleFileServer = "" ]
then
echo Not On!
fi
exit
Thanks!!

#!/bin/sh
if [[ `ps cx | grep AppleFileServer` = "" ]]
then
echo "Not On!"
fi
exit 0
I made 4 changes. The double square brackets in the test statement, the backticks around the ps|grep, double quotes on the echo string, and a 0 for the exit status. The tab in front of the echo statement is just for aesthetics.
Roger

Similar Messages

  • What should be a simple 'button' script

    Too old, too many hours working on this and too tight a deadline. This should be a simple script, but I'm getting nowhere fast!
    User enters a dollar amount into a field called 'Pay', clicks one of four radio buttons called 'Frequency' labeled 'Weekly', 'By-weekly', 'Monthly' and 'Annual'. Based on button pressed, a field called 'Annual' is updated to reflect the results of:
    Weekly = Pay * 52
    Bi-weekly = Pay * 26
    Monthly = Pay * 12
    Annual = Pay * 1
    Eventually, this form will be distributed throughout our entire organization, with completed forms being emailed to a central office. As a result, I'm working in LiveCycleES and Java, both of which I'm a novice with.
    Any assistance from this forum is greatly appreciated. Even a link to a working example of this process that I could decipher on my own would be a great help.
    Thanks so much.

    For a radio button group called 'frequency' where the value binding is
    1 - weekly
    2 - bi-weekly
    3 - monthly
    4 - annual
    you could add the following client-side JavaScript to the 'frequency' change event.
    var frequency = form1.subform1.frequency.rawValue;
    switch (frequency) {
    case "1":
    form1.subform1.annual.rawValue = form1.subform1.pay.rawValue * 52;
    break;
    case "2":
    form1.subform1.annual.rawValue = form1.subform1.pay.rawValue * 26;
    break;
    case "3":
    form1.subform1.annual.rawValue = form1.subform1.pay.rawValue * 12;
    break;
    case "4":
    form1.subform1.annual.rawValue = form1.subform1.pay.rawValue * 1;
    break;
    default:
    break;
    Steve

  • This should go on a Waterfox forum, but can't find one. Waterfox updater is failing, can't find the latest version. The website says the latest version ( 9.0.1) is only available via the uploader. Catch-22

    This should go on a Waterfox forum, but can't find one. Waterfox updater is failing, can't find the latest version. The website says the latest version ( 9.0.1) is only available via the uploader. Catch-22

    http://waterfoxproj.sourceforge.net/news/26/15/Powered-by-Mozilla-Waterfox-9-0-1
    Waterfox has now been accepted as a project by Mozilla and has been placed on their website! '''Waterfox 9.0.1 has also been released, but at the moment is only available through the internal updating program available in Waterfox 9.0. This is to try and iron out any issues for the release of Waterfox.Next.'''
    It is not a official Mozilla product as it is still third-party. http://www.mozilla.org/projects/powered-by.html

  • I am still having issues with the TOC. I finally got several chapters and sections to show different pictures in the TOC, but have spent hours trying to figure out how to repeat it. This should be so simple. Is there an update? Please help us Apple.

    I am still having issues with the TOC pictures. I got several chapter/section photos to show up, but can't seem to repeat this success. It is some mystery that happened during a time that I had practically given up. This should be such a simple thing. Drag and place a picture into the placeholder and it shows up in the TOC....right? Help, help help! want to get this thing done and it's taken two days of work just get some of the photos to show up. I am going to have to publish this ibook with no photos in several sections.....why can't this be simple? I have even had someone else spend hours trying to figure this out. This software is such a GREAT idea....come on...help with this little part of it.

    I had the same problem myself. I got to the point where I couldn't replace the photo, of a new chapter, in the TOC. What I did was to duplicate an existing chapter that was working and was able to replace it's TOC's photo. I also found that if you try different areas of the photo you can sometimes get it to replace correctly. For example, instead of dragging the new photo to the middle of an existing photo, try dragging it to the right top corner.

  • This should be a simple answer to a simple question.

    Hey gurus,
    I've looked all over this Forum and the JDeveloper 9i tutorial but I can't figure out how to disable the picklist box from my resultset. The searchable object is assigned to "MessageChoice" for the search option but that picklist value shouldn't be showing up in the resultset. I've tried all reconfiguring many of the options in the Property Inspector but nothing works.
    Thanks,
    -Scott

    Which technology set are you using? Are you using OAF - if this is the case try the OAF specific forum.
    http://forums.oracle.com/forums/index.jspa?categoryID=84

  • This should be a simple function but...

    i cant seem to figure it out.
    Hi everyone!
    I am working on a spreadsheet to help keep track of my finances but cannot figure out one very important formula. Heres an example of what i want to do. In cell A1, I've got the balance of my auto loan. In column C I've got a drop down menu of various bill; in the adjacent column i enter the amount I've paid towards that bill for that month. So when I select "Auto Loan" from the pull down menu, i want it to subtract the amount in the adjacent column from the amount in A1. I've tried using the VLOOKUP formula, however, this only returns one value, even when there is more than one cell with the matching criteria. I need it to return the sum of these cells.
    Can anyone help? Thanks! Rob

    Hi,
    I'm not sure how your table is formatted, but I thought this might illustrate a solution. I'm assuming that columns C contains all manner of daily expenses, food, clothing gas utilities, etc. I'm also assuming you are interested only in the "current" balance of you car payments, not intermediate balances from the initial amount. The formula is:
    =Auto Loan Balance Initial Balance-SUMIF(Expense,"Auto Loan",Monthly Payment)
    pw

  • This should be very simple...

    using the usb 9171 chassis and a ni-9411 module and Labview 2012
    I have one reflective optical reader wired to the 9411.
    this is mounted to the side of a conveyor bed to detect boxes passing by
    I've been trying to setup a VI to count the number of boxes that pass by the optical reader (that part is the easy part) but to also give me a gage that tells me boxes per minute (which could be as low as 1 box passes by per minute or up to 60 boxes per minute)
    any help??

    You could set up a frequency measurement task to do this.
    The tricky part is that the read is a blocking call--it waits until you have a sample available which only happens when a box passes by (starting with the 2nd box, the frequency measurement is computed by inverting the time between consecutive boxes).  You don't want to be stuck inside the DAQmx Read call for up to 1 minute.  A few ways to go about this:
    You can set the read timeout to some low value and discard the timeout error (-200284).  If you're using too much CPU you might need to add a wait to your loop in the timeout case (or maybe this is one of the rare times that setting the DAQmx Read Wait Mode to "Sleep" might actually help).
    You could poll the available samples per channel property to see when to read, but unfortunately polling available samples per channel does not query the onboard FIFO or initiate a transfer back to the software buffer (last I checked), so you'll be reading "0" for quite some time until the on-board FIFO starts filling up, at which point a large chunk of data will be transferred back to the DAQmx buffer in PC memory at once.  Note that this does not apply to PCI/PCIe DAQ devices which transfer data to the PC buffer pretty much as soon as possible--USB and Ethernet devices try to minimize the overhead of unnecessary data transfers but in this case it is a hindrance.
    Using the DAQmx Every N Samples event has the same problem as #2.
    Reading -1 samples returns whatever is in the DAQmx buffer in PC memory, so it also has the same problem as #2 (the read will return 0 samples until the hardware decides to transfer the data over to the PC).
    In your case, you might have luck with #2, #3, or #4 by setting the CI.DataXferReqCond to "Onboard Memory not Empty", but without being able to validate any of these workarounds I think I'm just going to recommend you use suggestion #1:
    You can either run this task in addition to your current edge count task (there are 4 counters on the 9171 which should be plenty given you can only have 1 module), or you can run it instead of it (poll back the Total Samples per Channel and add 1 to determine the count of boxes, however you wouldn't be able to distinguish between 0 and 1 boxes this way since the first sample is returned after the 2nd box passes).
    Best Regards,
    John Passiak

  • I think this should be a simple question

    I doing a slide show of 20 slides and need them to be 20 seconds long. All my slides are done and I am having a bit of a hard time finding where I can set the timing per slide. I've got some builds on a few slides. Those are the only ones that stay up longer.
    Seems simple enough. Apple just works...right?
    This is for Pecha Kucha night.

    Greeting and Welcome to the Forum:
    In the Inspector > Slide > Transition menu, after you designate the Effect you want for the Transition, set the Start Transition window to Automatic and the Delay to 20 seconds. For those slides with Builds, you may need to adjust this Delay setting to achieve the pacing that you desire. With a little trial-and-error you should be able to get everything flowing properly.
    Good luck.

  • This should be rather simple...

    Hello, I'm new to Dreamweaver and a novice website builder. I
    have a website that I've designed in a table. The top two rows
    remain the same on every page as well as the navigation running
    down a column on the left side. Is there a way to setup a script
    where you could click on a navigation button and the content/text
    would change in the adjoing cell to the right?
    I'm sure I'm forgetting some crucial information here, so
    feel free to ask for more detail.
    Thank you for your help in advance!

    That would be frames... DO NOT USE FRAMES!
    SSI (Server Side Includes) would be your best bet. You can
    create your menu
    on the left side and your headers at the top. In reality the
    whole page
    will change but the effect will be the same.
    Study up on html code, SSI and CSS styling.
    The greatest advantage is that you can modify your menu, put
    only that file
    to the server and every page on your site will be instantly
    updated without
    ever touching them.

  • What should be pretty simple install question, but I can't find answer....

    Hard drive C = 40, external hard drive G = 160. Want to load/store all music on G. When I downloaded iTunes and QuickTime from iTunes official website, I specified G as drive where I wanted software to go. iTunes went to G, Quck Time went to C. Music ends up being loaded to/stored on C. Not what I want.
    How do I do what I want to do?

    Set itunes to keep the library on G: You can delete current library and start fresf after setting iTunes to use G: or transfer library using this procedure.
    http://docs.info.apple.com/article.html?artnum=305451

  • Okay.... this should be very simple

    when i click on a text file... .php or .tcl or .c or whatever.... when i click on the source file i want it to open in a new console window in vi ....
    except from the command line i can;t even FIND vi or vim or gvim on this box...
    so, how do i associate text files with a given extension with vi (or the mac equivalent) so i can get some work done????

    The extension is of little relevance in Mac world. Find the file you want to open, Highlight it. Cick cnd+I. In the box that opens, down click the Open With triangle. Either select the applicatrion you want, or navigate to the application you want to open this. Thyen, hot "Change All.
    Is this what you want. I really have no idea what all the extensions are.

  • This should be a simple question...

    how do you change the music that plays during a photo slideshow in front row? thanks.

    yes, it can be deleted.
    http://docs.info.apple.com/article.html?path=Mac/10.4/en/mh2284.html

  • Please help with a simple UI scripting of CoverFlow!

    Hi, this should be so simple! all I want to do is use applescript to sort the iTunes library by artist (for instance) in CoverFlow mode. I could not see any way to do this using menus or hotkeys (I only found this in Grid mode.. God only know why..) so the only way is to click the "artist" column header.
    The UI inspector tells me that this is
    <AXApplication: “iTunes”>
    <AXWindow: “iTunes”>
    <AXSplitGroup>
    <AXSplitGroup>
    <AXScrollArea>
    <AXOutline>
    <AXGroup>
    <AXButton: “Artist”>
    Attributes:
    AXRole: “AXButton”
    AXRoleDescription: “sort button”
    AXSubrole: “AXSortButton”
    AXDescription: “(null)”
    AXHelp: “(null)”
    AXEnabled: “1”
    AXFocused: “1”
    AXParent: “<AXGroup>”
    AXWindow: “<AXWindow: “iTunes”>”
    AXTopLevelUIElement: “<AXWindow: “iTunes”>”
    AXPosition: “x=456 y=747”
    AXSize: “w=125 h=16”
    AXTitle: “Artist”
    AXSortDirection: “AXAscendingSortDirection”
    Actions:
    AXPress - press
    and I thought that this applescript was the way to go:
    tell application "System Events"
    click button "Artists" of the first group of the first outline of the first scroll area of the first splitter group of the first splitter group of window "iTunes" of application "iTunes"
    end tell
    unfortunately it compiles but when I launch it is says that the button doesn't understand the "click" message:
    iTunes got an error: «class butT» "Artists" of «class sgrp» 1 of «class outl» 1 of «class scra» 1 of «class splg» 1 of «class splg» 1 of window "iTunes" doesn’t understand the click message.
    What am I doing wrong? (and yes, UI access is enabled)
    please let me know asap
    thanks in advance!
    cheers

    found, this does the trick
    tell application "System Events"
    tell application process "iTunes"
    tell window "iTunes"
    tell splitter group 1
    tell scroll area 2
    tell outline 1
    tell group 1
    tell button "Artist"
    click
    end tell
    end tell
    end tell
    end tell
    end tell
    end tell
    end tell
    end tell
    hope this is useful for somebody else.

  • Simple BASH script to update subversion files

    This is just a simple BASH script that will update all .svn files in a specified directory.  If an update fails, it will attempt to update all the subdirectories in the failed one, so as much will be updated as possible.  Theoretically, you should be able to supply this script with only your root directory ( / ), and all the .svn files on your computer will be updated.
    #! /bin/bash
    # Contributor: Dylon Edwards <[email protected]>
    # ================================
    # svnup: Updates subversion files.
    # ================================
    #  If the user supplies no arguments
    #+ then, update the current directory
    #+ else, update each of those specified
    [[ $# == 0 ]] \
        && dirs=($PWD) \
        || dirs=($@)
    # Update the target directories
    for target in ${dirs[@]}; do
        # If the target file contains a .svn file
        if [[ -d $target/.svn ]]; then
            # Update the target
            svn up $target || {
                # If the update fails, update each of its subdirectories
                for subdir in $( ls $target ); do
                    [[ -d $target/$subdir ]] &&
                        ( svnup $target/$subdir )
                done
        # If the target file doesn't contain a .svn file
        else
            # Update each of its subdirectories
            for subdir in $( ls $target ); do
                [[ -d $target/$subdir ]] &&
                    ( svnup $target/$subdir )
            done;
        fi
    done

    Cerebral wrote:
    To filter out blank lines, you could just modify the awk command:
    ${exec awk '!/^$/ { print "-", $_ }' stuffigottado.txt}
    very nice; awk and grep: two commands that never cease to amaze me.

  • HT5772 How do you delete a movie from a local computer without deleting it from the library?  This should be such a simple procedure, but it's not. And while we're at it, why is iTunes NOT one of the dropdown product choices?

    All Apple support says about deleting movies from a computer is that you "should" be able to re-download it if you live in the right area.  Well, I'm in the U.S.A. and just deleted one of the movie extra features exactly as described in the support directions.  According to Apple I should be able to re-download this from the cloud at any time, but now I no longer even see the title listed.  That's why I wanted to test their support statements with a Movie Extra instedad of a real movie.  This should be the simplest of tasks to manage, yet they make it extremely difficult.  Why?  I own the movies and I want them to stay in my iTunes library basically forever.  Makes sense, right?  But, I only have so much room on my laptop to store movies that I want to have with me on long trips, etc.  So if I only have the space to store 3 or 4 movies on the disk, shouldn't I have the ability to every once in a while delete one of those movies from my local computer ONLY, NOT my library, so that I can download a different movie?  Yet the first thing iTunes does when you hit the delete key is tell you that it will remove the movie forever from all devices and the library.  So why does support say you can download again any time from the cloud then?  The worse part is, the calamity doesnt stop there.  Wait until you see the message you actually get once you say that yes, you do want to delete the movie (but only because you assume that you really can download it again sometime).  Here is the exact 2 messages you get from Apple, in the same popup box.
    Do you want to move the selected movie to the Recycle Bin, or keep it in the iTunes Media Folder?
    Only files in the iTunes Media Folder will be moved to the Recycle Bin.
    [Cancel]  [Move to the Recycle Bin]  [Keep File]
    Is that the most confusing popup or what?  Who develops this kind of software?!?!?! 
    I have tried it both ways and the only difference is that the file shows up in the Recycle Bin or doesn't.  But in both cases the file name no longer shows in the movie list, so I don't know how to re-download it from the Cloud.  Better hey, if I clicked "Keep File", where is it?  I can't see it anywhere, so where is it kept and what can I actually do with it?
    I have to be honest, I love my iPhone and some of the neat features, but when it comes to iTunes, I have never seen a more difficult piece of software to use in my life... and I'm a software developer.  Your Support documentation is actually more confusing than the softwae itself, it's almost as if you don't want people to use the software, just simply buy stuff and listen/watch it, but nothing else.  Seriously, this is the most cumbersome, unfriendly piece of software I've ever seen.  What does it say about Apple iTunes when everyone has to google solutions for how to do something rather than using Apple support documentation.
    Seriously disappointed in Apple iTunes and it's never really gotten any better over time.  This is one of the primary reasons I have never moved all of my recording studios and office operations over to an Apple platform.  Hardware and phones are awesome, but your software is either grossly incompetent or intentionally designed to make it all but impossible to use.  Either way, it's worthless to me. We're talking about software that does nothing else but manage media that I already own on multiple devices.  That should be one of the simplest things in the world to do.  Sad... very sad.
    While we're at it.... why isn't iTunes listed on the product dropdown below?  Maybe it's not even considered a product, which would explain it's goofiness I guess.

    I own the movies and I want them to stay in my iTunes library basically forever.
    But in both cases the file name no longer shows in the movie list, so I don't know how to re-download it from the Cloud.
    iTunes prefs > Store > Show iTunes in the Cloud purchases.
    This will show all your iTunes purchases in your library with a cloud icon down arrow. Click the icon to redownload or click on Play to stream without downloading.
    Also see this , -> Download past purchases
    and techncially, you don't "own" the movie, You simply have a license to use it.
    Yet the first thing iTunes does when you hit the delete key is tell you that it will remove the movie forever from all devices and the library.
    Actually, no it does not tell you that.
    FYI: You should keep copies of all yoru iTnue spurahses as the labels/movie studios/copyright owners can pull their product at anytime and it won't be available to redownload.
    Suggestions here -> http://www.apple.com/feedback/

Maybe you are looking for