How do I run a script at shut down?

Hi folks,
I wrote a script that runs at login that gets my dynamic IP and creates a simple web page with a link to my local computer address for Personal Web Sharing, and then uploads that web page with the link to my ISP homepage server.
I wrote another script that creates a web page with no link, but contains a message that my home computer is shut down.
This way, my ISP homepage can have a file that either points to my dynamic IP or has a message that my web server is down.
So How do I get the shut down script to run at shut down?
The shutdown script is basically just this to upload an existing html file:
curl -T shutdown_message.html -u userid:password ftp://ftp.web.isp.server.com/
or you can dynamically create an html file with current date and expected date you will be back on-line, or whatever, with some simple perl code.
Thanks.
G3 Desktop, SonnetEncoreZIF G4 1GHz, 768MB, WingsAV-6MB, DVR-106D, 60GB Maxtor   Mac OS X (10.4.7)   PCI: TempoUltraATA66-120GB Maxtor, 120GB Seagate; TangoUSB/FW; Radeon9200-17"LCD

Thanks, guys. For the most part I think the DSL keeps the same IP except when I power down. My power went out just as I finished my login upload script, so my first test was out of necessity, and it worked. I could set it up as a cron job on my local machine to regularly test the IP and upload the page.
reese, When I have a power loss, or non-planned abnormal shutdown, my web page will be out of sync, unless I use something on the ISP server, so that is a good point. I am not sure what kind of scripts I can run on my ISP web server. I don't know if I can set up a regularly scheduled script, or if it would only respond to requests, then it could perform the test on demand. I need to give that some more study. Good suggestion.
As far as a normal planned shutdown, I thought of one possible work around: to create a script that runs my upload and then executes the shutdown, either by AppleScript or UNIX shutdown command line, not sure which is the most graceful.
Gary, I looked in the /System/Library/StartupItems and found the Apache scripts in there. They have a StartService and StopService methods defined. I think I could use that as a template to create my own, or just add my scripts to the Apache methods. Since basically I want to run something as Apache is started and again when it stops. That may be the most graceful method. As Apache can get shut down when the machine remains on via System Preferences. You solved my problem Gary, but I marked your message as helpful already. Post back again and I'll give you the Solved Star & points.
G3 Desktop, SonnetEncoreZIF G4 1GHz, 768MB, WingsAV-6MB, DVR-106D, 60GB Maxtor Mac OS X (10.4.7) PCI: TempoUltraATA66-120GB Maxtor, 120GB Seagate; TangoUSB/FW; Radeon9200-17"LCD

Similar Messages

  • How do I run a script on a .indb file?

    How do I run a script on a .indb file? What should I do differently than in running one on a single indd file?

    I do this like so:
    var inddFiles = GetFilesFromBook();
    for (var i = 0; i < inddFiles.length; i++) {
        inddFile = inddFiles[i];
        app.scriptPreferences.userInteractionLevel = UserInteractionLevels.NEVER_INTERACT;
        doc = app.open(inddFile);
        app.scriptPreferences.userInteractionLevel = UserInteractionLevels.INTERACT_WITH_ALL;
        // Process document
        doc.close(SaveOptions.YES);
    function GetFilesFromBook() {
        var bookContent, file,
        activeBook = app.activeBook,
        files = [];
        for (var i = 0; i < activeBook.bookContents.length; i++) {
            bookContent = activeBook.bookContents[i];
            if (bookContent.status != BookContentStatus.MISSING_DOCUMENT) {
                file = new File(bookContent.fullName);
                files.push(file);
        return files;
    Here is the whole script that you can use as example.

  • How can i run unix script from my apex page

    how can i run unix script from my apex page and take the output of unix script as a hidden variable and display it on the report region of that page

    I had a requirement to run a Fortran program against some data that woudl be extracted from the database after the user set up their filtering criteria and made some additional input. SInce the program was to complex to conver to PL/SQL, we decided to try and invoke it from Apex. This is how I did it.
    1. I followed the steps in Tim Archer's excellent article "Oracle External Procedure to Run Host Commands" (http://www.timarcher.com/?q=node/9). If the link does nto work, google the article's title.
    Using this steps I created a function which accepts any OS command, including calling my own shell scripts, and runs them. I called my PL/SQL function "shell" instead of "USF_RUN_HOST_CMD " as Tim did in his example (step 9).
    2. In Apex,
    a. I created a button to run my shell command. (I named it P2_RUN_SHELL)
    b. I created a PL/SQL process whose source looks as follows:
    shell('/home/ackness/scripts/cr_xcf_file.sh > /tmp/cr_scfp_file.log');
    and which was conditioned on the the button P2_RUN_SHELL.
    It works like a charm.
    Note: since you can run your own scripts using this method, you can encapsulate a series of commands in a UNIX shell script and invoke that script from Apex. This allows you to be able to test or run you commands from the command line as well as Apex and makes it easier to develop/debug/enhance the scripts in the future.
    Ackness

  • A script to shut down Weblogic

    Hello,
    I use Weblogic Server 5.1 on NT with jdk 1.2.1.
    I have a script that shut down Weblogic :
    java weblogic.Admin http://localhost:80 SHUTDOWN system mypassword
    but this still give me this message :
    "Can't find class weblogic/Admin or Something it requires"
    Does I have to set classpath first ?
    Then, I change my script to :
    set PATH=d:\jdk1.2.1\bin;d:\weblogic\bin;%PATH%
    set CLASSPATH=.;
    set CLASSPATH=d:\weblogic\classes\boot;%CLASSPATH%
    set CLASSPATH=d:\weblogic\lib;%CLASSPATH%
    set CLASSPATH=d:\weblogic\classes;%CLASSPATH%
    java -classpath %CLASSPATH% weblogic.Admin http://localhost:80 SHUTDOWN
    system weblogic
    but it still give me an error :
    "Exception in thread "main" java.lang.NoClassDefFoundError :
    javax/naming/NamingException"
    Can you give me a script example to shutdown Weblogic on NT ?
    I also want to know if the console can be install on client and how ?
    Thanks a lot
    M.L.

    Make sure u have run the setEnv.cmd script.
    ml wrote:
    Hello,
    I use Weblogic Server 5.1 on NT with jdk 1.2.1.
    I have a script that shut down Weblogic :
    java weblogic.Admin http://localhost:80 SHUTDOWN system mypassword
    but this still give me this message :
    "Can't find class weblogic/Admin or Something it requires"
    Does I have to set classpath first ?
    Then, I change my script to :
    set PATH=d:\jdk1.2.1\bin;d:\weblogic\bin;%PATH%
    set CLASSPATH=.;
    set CLASSPATH=d:\weblogic\classes\boot;%CLASSPATH%
    set CLASSPATH=d:\weblogic\lib;%CLASSPATH%
    set CLASSPATH=d:\weblogic\classes;%CLASSPATH%
    java -classpath %CLASSPATH% weblogic.Admin http://localhost:80 SHUTDOWN
    system weblogic
    but it still give me an error :
    "Exception in thread "main" java.lang.NoClassDefFoundError :
    javax/naming/NamingException"
    Can you give me a script example to shutdown Weblogic on NT ?
    I also want to know if the console can be install on client and how ?
    Thanks a lot
    M.L.

  • My phone doesnt hold it's charge and runs hot even when shut down.  what can i do to fix.

    My pone will not hold it's charge as long as it should and runs hot even when shut down.

    Shutdown all apps that may be running in the background by double clicking the home button, touch and hold an app until they all start to jiggle, then one at a a time dismiss each.  Then turn off all services you don't need, such as Bluetooth if you don't use it.
    Fully charge and see how the iPhone works, does it retain charge, run at a normal temp?  If it still is hot, etc., take it to an Apple store genius bar for testing by the techs.

  • I have forgotten my appleID password and the email it is linked to is deactivated, security questions aren't working. This is on my iPhone and iTunes acs so I can't sync with my new computer. How do I merge AppleID accounts and shut down the old one?

    I have forgotten my appleID password and the email it is linked to is deactivated, security questions aren't working. This is on my iPhone and iTunes acs so I can't sync with my new computer. How do I merge AppleID accounts and shut down the old one (when I have no password and the security questions aren't working?)

    You cannot merge Apple ID accounts, that has never been supported.
    You can contact the Apple ID Security folks per the listing in http://support.apple.com/kb/HT5699 and they can help reset security questions and get the account working.

  • When an internet connection is available, I run iTunes and it shuts down on my Windows 7 64bit computer.

    When an internet connection is available, I run iTunes and it shuts down on my Windows 7 64bit computer.  It used to crash when I went to the iTunes store but, after installing the newest version of iTunes it crashes if there is an internet connection.  I can turn off my internet access and then run the software but, once I try the iTunes store again it crashes.  It does not give an error message as to why its doing this.  Just says it encountered a problem.  I cannot do anything with my iPad or iPod without this working.  Its extremely frustrating.
    I have also contacted Apple several times and they give me links to other's problems but, none have worked to fix this.

    Close your iTunes,
    Go to command Prompt -
    (Win 7/Vista) - START/ALL PROGRAMS/ACCESSORIES, right mouse click "Command Prompt", choose "Run as Administrator".
    (Win XP SP2 & above) - START/ALL PROGRAMS/ACCESSORIES/Command Prompt
    In the "Command Prompt" screen, type in
    netsh winsock reset
    Hit "ENTER" key
    Restart your computer.
    If you do get a prompt after restart windows to remap LSP, just click NO.
    Now launch your iTunes and see if it is working now.

  • How do I change the default on shutting down Lion to NOT relaunch open windows?

    How do I change the default on shutting down Lion to NOT relaunch open windows? And how can I have Safari always open in full screen mode? I have to set it every time I open Safari.

    The feature you are talking about in System Preferences does work and is not related in any way to the one at startup.
    One restores the windows of an application you've quit, the other reopens all windows you had open at shutdown or restart.
    Why should "I" have to constantly turn off a checkbox when I shutdown the system?
    You don' t have to.  Did you have a look at my post just above yours?  With a double click you can have your restart without opening the last open windows.  That's less than clicking the apple icon and selecting "restart" or "shut down" and then clicking "Restart" or "Shutdown" again.

  • How do I log in after a shut down when I forgot the password

    How do I log in after a shut down when I forgot the password

    Forgot Mac Password? How to Reset Your Mac Password (with or without CD)
    Change the Admin Password with Mac OS X Single User Mode

  • Firefox will not connect to internet after upgrade. The window pops up but shows "connecting " in tab. And then it sit there. Close it down and then try to reopen it and get message " Firefox already running, Exit program or shut down computer" ???

    Firefox will not connect to internet after upgrade. The window pops up but shows "connecting " in tab. And then it sit there. Close it down and then try to reopen it and get message " Firefox already running, Exit program or shut down computer" ?????????????????

    1st problem see http://kb.mozillazine.org/Firewalls
    2nd problem, to close Firefox properly use File > Exit
    :not with the [x] in upper right corner which close window
    :see http://kb.mozillazine.org/Firefox_hangs#Hang_at_exit
    :if restarting use "Restartless Restart" extension as mentioned there.
    <br><small>Please mark "Solved" one answer that will best help others with a similar problem -- hope this was it.</small>

  • How do I keep my iPad from shutting down?

    How do I keep my iPad from shutting down?
    LB

    Try This...
    Close All Open Apps... Sign Out of your Account... Perform a Reset... Try again...
    Reset  ( No Data will be Lost )
    Press and hold the Sleep/Wake button and the Home button at the same time for at least ten seconds, until the Apple logo appears. Release the Buttons.
    http://support.apple.com/kb/ht1430
    Note:
    Also consider Deleting any Apps you have Purchased / Downloaded but you now never use..

  • How do you prevent the computer from shutting down when in sleep mode?

    How do you prevent the computer from shutting down when in sleep mode and plugged in?

    Thanks tjk.
    Those are great suggestions and got me looking in places I had not considered before. Unfortunately, the problem remains. The System Preferences did not have the shut down option activated and there are no parental controls active on the computer.
    Any other suggestions are welcome.
    Brian

  • Hey, constantly since I installed the iOS 7.1 upgrade, my iPhone has been constantly shutting down and I think it's really frustrating and I whant to know how I can stop my iPhone from shutting down so I can downgrade to iOS 7.0.4?

    Hey, constantly since I installed the iOS 7.1 upgrade, my iPhone has been constantly shutting down and I think it's really frustrating and I whant to know how I can stop my iPhone from shutting down so I can downgrade to iOS 7.0.4?

    7.1.1 is certainly compatible with the iPhone 4. Just try a reset first.
    Close all open apps by double-tapping the home button, then swiping up and off the screen with the app window (not the smaller icon).
    Reset your device: hold down the home button along with the sleep/wake button until the screen goes black and you see the Apple, then let go. (No data loss)

  • Script to shut down macs running retrospect client once backup is complete?

    This was previously posted in another forum, so apologies, but have been advised this is the best place to post this query.
    I have a network of approx 10 macs which are backed up by EMC Retrospect. Under previous versions of Retrospect which ran under system 9 and earlier, you could shut a mac down, it would go to sleep, then when the backup was finished the mac would shut down. This no longer works on OS10.x so we have to leave all the macs on all night to ensure the backup is completed which is a terrible waste of power. So, my question is, is there some way a script could make a mac shut down after an event (eg. after Retrospect has backed up its contents) to prevent us having to run all the computers all night?
    There is some extra complexity from the fact that there is one mac running the Retrospect application which talks to all the other macs which run retrospect client. It's only the client macs which need shutting down as Retrospect itself has a function to shut down after backup is complete.
    thanks
    Luke

    I searched for "shutdown" in Dantz's (Knowledgebase (found it there: http://www.retrospect.com/supportupdates/technical/retrospect/) and found and article called "Can Retrospect shutdown my Macintosh OS X computer after the backup?" the download of the script is located on the right side (attached file called cShutdown_1.1.dmg) soooo small this link, sooo big the dmg (1MB), soo small the Script (66kb)
    The AppleScript (run-only script-installer) creates a crontab (I think) that checks each hour if a Backup has finished that day and shuts down the computer if no user is logged in.
    I would try to write a routine on my own, but I do not use retrospect at all, so I do not know how to figure out if a backup has been finished or not...

  • How can I run a script last?

    Hiya,
    I have a single backup job running a single dataset. That single dataset has an include statement to include a dataset directory, which holds individual datasets for the several hosts I want to back up, each with potentially different parameters. This works well, the hosts back up in some order (I don't care), everything's happy.
    However, what I want to do is add a step on the end of this process to run a report on the admin server after all the backups are complete. That is, to run a script once, last.
    If I add an "after backup" command in the dataset, it runs it (as stated in the manual) on the client servers, after every backup, which is no good to me. I've tried creating a separate job and scheduling it at a lower priority a few minutes later than the backup job, but that seems to just run when it feels like it, I presume because there aren't any conflicts so why shouldn't it?
    Can anyone advise how I should be doing this?
    Related question... I've tried putting an "after backup" step on the Catalog backup job, but that appears to get run twice (I presume because there are two "include" steps in the catalog dataset)! Is this expected? How can I get it to just run once, after the catalog backup is complete?
    Thanks,
    David.

    Thanks Donna, but... no. It didn't work.
    We've actually purchased a license for OSB, so I've fired this question at our official support channel now, and they came back with the same answer at the same time (are you the Oracle techie looking at my problem, by any chance?). For the record here's (with some tweaks for readability in this context) what I've sent back in response to that article.
    From the article, I thought perhaps the following might do the trick:
    include dataset /Hosts {
    after backup optional "/usr/local/osb/pre-n-post after-fsd-hosts mail"
    But, from the log:
    2010/11/05.07:26:58 trouble parsing dataset in FSdaily line 1 - open brace appears where not allowed (OB dataset mgr)
    "010/11/05.07:26:58 offending line is "include dataset /Hosts {
    2010/11/05.07:26:58 trouble parsing dataset in FSdaily line 3 - bad nesting (OB dataset mgr)
    "010/11/05.07:26:58 offending line is "}
    So it appears I’m not actually allowed to do that. I don’t understand why that would be.
    The only other idea I have is to include a dummy backup step, backing up something really small (because OSB won’t let you run a backup without backing anything up - sigh!), tack a script onto that, and hope like heck OSB decides that it should run that last. All the documentation I’ve read gives the impression that datasets are all about scope, not order, so I’m not altogether confident that this will work. In any case, it seems a pretty kludgy way of doing it! And, given the next paragraph below, I’m not all that sure it’ll work in any case.
    My idea of scheduling a catalog backup for five minutes later than the client backups, with a lower priority, so that it runs when the client backups finish, also has a flaw - if I use two tape drives in parallel, it runs the catalog job in parallel with the last client job, which is completely useless. I want to put on the end of the tape a backup of the catalog as at just after the client backups, so that in the case of a disaster I can restore that and I’ll be good to restore everything else.
    In addition to being completely useless for the purposes of putting an “after” catalog backup on the end of the tape, it’s also completely useless for the purposes of running a script last - I tried the following:
    include catalog {
    after backup optional "/usr/local/osb/pre-n-post after-catalog mail"
    This ran the pre-n-post script twice, once for each component of the catalog, which is altogether not what I want it to do.
    I can’t think of any way to achieve a catalog backup on the end of the script except for scheduling it for some time later and hoping the dataset backups always finish by then. Ugly.
    The only way I can think to achieve the run-a-script-last is to munge all the datasets together into one humongous dataset file, and do stuff as in the article to try to bend OSB to my will (again, hoping that OSB obeys the order of statements in the dataset). Which, when I’m given the ability to use “include dataset /Hosts” to make it easy to maintain, seems a bit of a mean trick to pull on me. And, again, with two tape drives available I’m not at all sure it’ll work in any case.
    I'll post further results as they come to light...
    David.

Maybe you are looking for

  • Barcode doesn't show up

    Post Author: Andreas Hausjell CA Forum: .NET I'm using Crystal Reports X (Sp6) and Visual Studio 2005 C# I have got a very simple report with a barcode and following problems: 1. The printer I'm using is a Zebra PAX 110 which has got some internal ba

  • Turning on my apple tv

    When i turn on my apple tv using my universal remote, the little light on my apple tv unit turns on (indicating that it is ON) however, my tv screen is blank (and yes, i double check to make sure i have the correct hdmi input set on my tv).  in order

  • Codebase in applet tag

    hi Here is my html file <html> <body> <applet codebase = "Coorclasses/" code = "CoordinateConverterApplet.class" archive = "FITSWCS.jar" width=380 height=400></applet> </body> </html> It works fine.In the above case my ".class" file (CoordinateConver

  • InvocationTargetException:There was an error while invoking the operation.

    Hi, I am having issues getting my remote server configured right after everything working properly on the local host. I am getting the following error: InvocationTargetException:There was an error while invoking the operation. Check your operation in

  • E-Commerce: Customizing Store Appearance

    I am a student building an e-commerce site. I would rather not use and imbed code from an outside e-commerce site. My question is, how do I customize the appearance of catalogs/product pages, my shopping cart page, etc.? The default colors, fonts, an