Have a bash script run every time an application is opened.

Hi,
On my Arch box I would like to have a bash script run every time a certain application is opened from the menu. I would prefer a delay of a 5 - 10 seconds after the program opens if that is possible. Could someone please let me know if and how I can achieve this?

Problem is, OP wants the "meat" of his script to run after the program, which would mean putting it after the exec. But AFAIK, anything after the exec will be ignored. You could call another script to run in the background before the exec, but that seems hackish.
Last edited by alphaniner (2013-04-10 14:57:01)

Similar Messages

  • I have an iPad 2, and every time ii attempt to open a new page "about blank" appears. What can I do to get rid of this from my system baring in mind that I am not particularly computer literate.  Many thanks

    I have an I pad 2, and when I attempt to open a new page "about blank" appears. What can I do to remove this from the system baring in mind that I am not particularly co outer literate.
    Many thanks

    Is this in safari?
    try going into settings, safari and clear history. You may also want to clear cookies (means you will need to sign back into sites)
    It's possible that that page is a popup ad of some sort that can't run, for example a flash based ad.  You may have picked the cookie up browsing the internet and now that it's in there the only way to get rid of it is to clear your history and cookies.

  • Spotify crashes every time _other_ application is opened

     When I start a new OS X application and Spotify is running in the background, Spotify crashes. Here's the crash log from Spotify version 1.0.8.59.gee82e7e6 on OS X 10.11 (15A204h). Exception Name: NSInvalidArgumentException
    Description: -[SPMediaKeyTap grab]: unrecognized selector sent to instance 0x7fe9bb6071c0
    User Info: (null)
    0 CoreFoundation 0x00007fff8f1b4a55 __exceptionPreprocess + 165
    1 libobjc.A.dylib 0x00007fff8f92b13a objc_exception_throw + 48
    2 CoreFoundation 0x00007fff8f1b7a5d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
    3 CoreFoundation 0x00007fff8f0f2f3a ___forwarding___ + 1002
    4 CoreFoundation 0x00007fff8f0f2ac8 _CF_forwarding_prep_0 + 120
    5 Spotify 0x00000001037eced7 _ZNSt3__18multimapI13CefStringBaseI20CefStringTraitsUTF16ES3_NS_4lessIS3_EENS_9allocatorINS_4pairIKS3_S3_EEEEE16__construct_nodeIRA28_KcRA2_SD_JEEENS_10unique_ptrINS_11__tree_nodeINS_12__value_typeIS3_S3_EEPvEENS_21__map_node_destructorINS6_ISN_EEEEEEOT_OT0_DpOT1_ + 66135
    6 Spotify 0x00000001037ed063 _ZNSt3__18multimapI13CefStringBaseI20CefStringTraitsUTF16ES3_NS_4lessIS3_EENS_9allocatorINS_4pairIKS3_S3_EEEEE16__construct_nodeIRA28_KcRA2_SD_JEEENS_10unique_ptrINS_11__tree_nodeINS_12__value_typeIS3_S3_EEPvEENS_21__map_node_destructorINS6_ISN_EEEEEEOT_OT0_DpOT1_ + 66531
    7 Spotify 0x00000001037ed15a _ZNSt3__18multimapI13CefStringBaseI20CefStringTraitsUTF16ES3_NS_4lessIS3_EENS_9allocatorINS_4pairIKS3_S3_EEEEE16__construct_nodeIRA28_KcRA2_SD_JEEENS_10unique_ptrINS_11__tree_nodeINS_12__value_typeIS3_S3_EEPvEENS_21__map_node_destructorINS6_ISN_EEEEEEOT_OT0_DpOT1_ + 66778
    8 Spotify 0x00000001037ec8a0 _ZNSt3__18multimapI13CefStringBaseI20CefStringTraitsUTF16ES3_NS_4lessIS3_EENS_9allocatorINS_4pairIKS3_S3_EEEEE16__construct_nodeIRA28_KcRA2_SD_JEEENS_10unique_ptrINS_11__tree_nodeINS_12__value_typeIS3_S3_EEPvEENS_21__map_node_destructorINS6_ISN_EEEEEEOT_OT0_DpOT1_ + 64544
    9 HIToolbox 0x00007fff884a127e _ZL23DispatchEventToHandlersP14EventTargetRecP14OpaqueEventRefP14HandlerCallRec + 1231
    10 HIToolbox 0x00007fff884a0708 _ZL30SendEventToEventTargetInternalP14OpaqueEventRefP20OpaqueEventTargetRefP14HandlerCallRec + 404
    11 HIToolbox 0x00007fff884a056b SendEventToEventTargetWithOptions + 43
    12 HIToolbox 0x00007fff8852ed3c HIToolboxLSNotificationCallbackAllASNsFunc + 298
    13 LaunchServices 0x00007fff8d38c028 ___LSScheduleNotificationFunction_block_invoke_2 + 47
    14 CoreFoundation 0x00007fff8f0c68dc __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
    15 CoreFoundation 0x00007fff8f0b93a5 __CFRunLoopDoBlocks + 341
    16 CoreFoundation 0x00007fff8f0b9102 __CFRunLoopRun + 2274
    17 CoreFoundation 0x00007fff8f0b85b8 CFRunLoopRunSpecific + 296
    18 HIToolbox 0x00007fff884c9ce9 RunCurrentEventLoopInMode + 235
    19 HIToolbox 0x00007fff884c9a7f ReceiveNextEventCommon + 432
    20 HIToolbox 0x00007fff884c98bf _BlockUntilNextEventMatchingListInModeWithFilter + 71
    21 AppKit 0x00007fff92e5a732 _DPSNextEvent + 927
    22 AppKit 0x00007fff93227f74 -[NSApplication _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 324
    23 AppKit 0x00007fff92e506c2 -[NSApplication run] + 682
    24 Chromium Embedded Framework 0x0000000104e53831 cef_time_delta + 359761
    25 Chromium Embedded Framework 0x0000000104e5300c cef_time_delta + 357676
    26 Chromium Embedded Framework 0x0000000104ea46b3 cef_time_delta + 691155
    27 Chromium Embedded Framework 0x0000000104e912ed cef_time_delta + 612365
    28 Spotify 0x0000000103ed7259 _ZNSt3__16vectorI12CefPageRangeNS_9allocatorIS1_EEE21__push_back_slow_pathIS1_EEvOT_ + 40873
    29 Spotify 0x00000001037e32be _ZNSt3__18multimapI13CefStringBaseI20CefStringTraitsUTF16ES3_NS_4lessIS3_EENS_9allocatorINS_4pairIKS3_S3_EEEEE16__construct_nodeIRA28_KcRA2_SD_JEEENS_10unique_ptrINS_11__tree_nodeINS_12__value_typeIS3_S3_EEPvEENS_21__map_node_destructorINS6_ISN_EEEEEEOT_OT0_DpOT1_ + 26174
    30 Spotify 0x00000001036c34f9 Spotify + 29945
    31 Spotify 0x00000001036c34e4 Spotify + 29924 

    Try a clean reinstall of Spotify to see if this fixes the problem:
    Advanced method:
    https://support.spotify.com/learn-more/faq/#!/article/reinstallation-of-spotify
    Easy method:
    Download this free app cleaner. It's super easy. Download button is on the right side
    http://www.freemacsoft.net/appcleaner/
    When you open up the app, click the search icon and search for Spotify and it will automatically find and delete all files on your computer related to Spotify.
    I use it all the time and it's a really great tool. If you ever decide to uninstall an app, the best way is to use this tool.
    After that, download and reinstall Spotify.

  • Why does it ask me to register every time the application is opened?

    Why does the application manager ask me to license, or trial my software everytime that I open any of the applications? I thought it was only suppose to check every 30 days?

    Hi Leetou02,
    You're correct, it is only supposed to check every 30 days.
    You might install the latest version of the Adobe Application Manager from here:
    CS6 applications in Creative Cloud unexpectedly revert to trial mode | CS6, CCM
    http://helpx.adobe.com/creative-suite/kb/trial--1-launch.html
    and ensure everything with your internet connecity and firewall software is set correct from here:
    Sign in or activation errors | CS6, CS5.5 Subscriptions, CS6 Perpetual
    http://helpx.adobe.com/x-productkb/policy-pricing/activation-network-issues.html
    -Dave

  • Every time I try to open itunes I get a message saying "runtime error. An application has made an attempt to load the C runtime library incorrectly. I have already un- and re-installed it, but i get the same message as before. How do i fix this?

    every time I try to open itunes I get a message saying "runtime error. An application has made an attempt to load the C runtime library incorrectly. I have already un- and re-installed it, but i get the same message as before. How do i fix this? I don't want to lose my music and would at least want to save that.

    Follow the instructions of tt2 given in https://discussions.apple.com/thread/5822086 and note to run as admin

  • I am recording with Logic Pro X, using my Yamaha XS8 keyboard as a Midi controller. I also have a Thunderbolt Display. Every time I play and release a note on the keyboard, the Thunderbolt Display speaker emits a doink sound. How do I get it to stop?

    I am recording with Logic Pro X, using my Yamaha XS8 keyboard as a Midi controller. I also have a Thunderbolt Display. Every time I play and release a note on the keyboard, the Thunderbolt Display speaker emits a doink sound. What is causing it and how do I get it to stop? My sound is running through the Saffire Pro 40 Interface (Focusrite) into external speakers with powered amps.
    Also, When I record I am hearing little pops in the system. I have checked all of my meters and they are not clipping. What is causing it and how do I get it to stop?
    Ken

    MUYconfundido wrote:
    Pancenter,
    Thanks for the response, but I do not have a midi interface. I am using a midi to usb connector cable, thus bypassing the need for a Midi interface.
    The Mac reads the USB cable as a midi device, but not the keyboard that I am trying to use as a controller. I have tried it with my korg sp 300 and with my Nord Electro 2.
    Thoughts?
    Thanks,
    Tristan
    Tristan...
    This is what you have, correct?
    http://www.alesis.com/usbmidicable
    This from Alesis..
    "The AudioLink Series USB cable receives and outputs MIDI signal thanks to its internal interface. The USB-MIDI Cable connects plug-and-play to your Mac or PC for an all-in-one USB-MIDI solution."
    Notice, -internal interface-. What you have is a simple USB MIDI Interface. Most MIDI interfaces are USB.
    My point is (was), MIDI OUT of the Korg goes to the connector marked MIDI IN on the Alesis, those new to MIDI often get this wrong.
    pancenter-

  • Load remote images in html mail setting does not get saved. I have to turn it off every time I log in. Is this a bug?

    Load remote images in html mail setting does not get saved. I have to turn it off every time I log in. Is this a bug?

    Plug your phone into the wall charger for at least 30 minutes...make sure you have a sim card in the phone...then:
    Leave the USB cable connected to your computer, but NOT your phone, iTunes running, press & hold the home button while connecting the USB cable to your dock connector, continue holding the home button until you see “Connect to iTunes” on the screen. You may now release the home button. iTunes should now display that it has detected your phone in recovery mode, if not quit and reopen iTunes. If you still don’t see the recovery message repeat these steps again. iTunes will give you the option to restore from a backup or set up as new.
    Make sure you have no anti-virus software running or any firewalls...turn all of that stuff off.

  • For some strange reason the songs in my library are multiplying. For example, I really only have 4,000 songs but every time I open itunes I have 6,8,10,000 songs! Any one else have this problem.  How do I stop that from happening?

    For some strange reason the songs in my library are multiplying. For example, I really only have 4,000 songs but every time I open itunes I have 6,8,10,000 songs! Any one else have this problem.  How do I stop that from happening?  I keep having to delete my library!

    This "original file cannot be found" thing happens if the file is no longer where iTunes expects to find it. Possible causes are that you or some third party tool has moved, renamed or deleted the file, or that the drive it lives on has had a change of drive letter. It is also possible that iTunes has changed from expecting the files to be in the pre-iTunes 9 layout to post-iTunes 9 layout,or vice-versa, and so is looking in slightly the wrong place.
    Select a track with an exclamation mark, use Ctrl-I to get info, then cancel when asked to try to locate the track. Look on the summary tab for the location that iTunes thinks the file should be. Now take a look around your hard drive(s). Hopefully you can locate the track in question. If a section of your library has simply been moved, or a drive letter has changed, it should be possible to reverse the actions.
    Alternatively, as long as you can find a location holding the missing files, then you should be able to use my FindTracks script to reconnect them to iTunes .
    tt2

  • Bash script run via cron not executing MYSQL command

    I have a bash script which is run from a cron,
    It is executing as I have it write to a log file which it does correctly.
    I am wanting the bash script to restore a mysqldump file.
    When I run the bash script manually the dump file gets loaded fine. But when I run it through the cron the mysql command appears to be ignored.
    The mysqldump file is 54MB and I have checked to make sure that MYSQL is included in the global users path in /etc/profile
    Does anyone know why this maybe??
    Here is the bash file
    #!/bin/bash
    date >> /home/user/crons/crons.log
    echo "Started loadbackup" >> /home/user/crons/crons.log
    cd /home/user
    dbuser=root
    dbpass=password
    dbname=databasename
    filename=backup
    mysql -hlocalhost -u"$dbuser" -p"$dbpass" "$dbname" < " >> /home/user/crons/crons.log
    My crontab looks like
    02 17 * * * /home/user/crons/loadbackup.sh
    Many thanks
    Richard

    Hi Richard,
    Have you tried redirecting the script output in the cron to see if an error is being reported?
    I.e.
    02 17 * * * /home/user/crons/loadbackup.sh > /tmp/loadbackup.log 2>&1

  • I have Elements 10 and every time I go to open a file in the editor it shows its thinking and then it just shuts down the entire program. I have a big wedding I am working on and lots of other sessions. Please PLEASE help!!!!

    I have Elements 10 and every time I go to open a file in the editor it shows its thinking and then it just shuts down the entire program. I have a big wedding I am working on and lots of other sessions. Please PLEASE help!!!!

    And you are quite persistent, Menu Boy, in offering pernickety and pointless prattle, in response to a "support page" on iPad's buggy Pages App.
    Let's summarise, for those reviewing this threadless thread for app support..
    Mobile pages works reliably for simple docs, especially creating letters and Menus for Microsoft's Kindy canteen (even on special days with nice big pictures).
    When importing more complex docs and/or working with larger creations, it is prone to randomly corrupting files upon re-opening, along similar lines as Word (running on a PC).
    So, Menu Boy, do they let you sneak into classes every now and then? What is the secret to their training? "Say after me, if any I.T. product works just some of the time, that's a job well done, and if something randomly stops working, we call that the user's fault... And if they complain, we call them names."

  • Post-Install Issue - Windows Installer runs every time CRW XI R2 loads

    I have XP SP3.  If I uninstall CR XI SP2 and re-install CR XI from cd, it loads perfectly - no windows installer.  When I uninstall CR XI, and re-install CR XI SP2 from the saved download on my harddrive, the Windows installer runs every time I load it; it seems to think it's never been run before.  Takes 3-8 minutes to load every time, which is completely annoying.
    I have also tried downloading that full build of XI SP2 3 times - and uninstalling/reinstalling.  Makes no difference.
    I know this is not a design issue, but I didn't know where else to turn.  I have been tolerating this issue for about 18 months and I can't take it any more! 
    Thanks!

    Hi,
    Please try using other computer units then update me the result, the purpose is to check if your unit OS may be the problem.
    Regards,
    Clint

  • Launchd: how to make a script run every weekday?

    I'm trying to make a script run every weekday as a LaunchAgent. Is there a way to do this like you could in cron?
    Here is the relevant portion of my LaunchAgent plist:
    <key>StartCalendarInterval</key>
    <dict>
    <key>Hour</key>
    <integer>9</integer>
    <key>Minute</key>
    <integer>0</integer>
    <key>Weekday</key>
    <integer>3</integer>
    </dict>
    I have tried changing the Weekday integer to 1-5 or 1,2,3,4,5 but neither worked. It only works with a single integer. Do I have to create 5 separate plists for each weekday?
    Any ideas?

    Thanks VK, for others who are looking to do something similar, here is the relevant part of the code to make the command run every day (since that field is missing) at 7:00pm and 7:01pm:
    <key>StartCalendarInterval</key>
    <array>
    <dict>
    <key>Hour</key>
    <integer>19</integer>
    <key>Minute</key>
    <integer>00</integer>
    </dict>
    <dict>
    <key>Hour</key>
    <integer>19</integer>
    <key>Minute</key>
    <integer>01</integer>
    </dict>
    </array>

  • Why does Lenovo Solution Center keep running every time I log back on?

    Hi all,
    Have a Thinkpad L430.
    Every time I log back into my user account on the laptop, whether from fresh boot, sleep or hibernate, within a few minutes I get interrupted by the Windows 7 User Account Control asking me if I want to allow lsc.exe to run.
    If I view details it says it is program location '"C:\Prgam Files\lenovo\lenovo solution center\lsc.exe" -updatestatus'.
    I've no problem with the machine checking for updates but a) I'd rather it did it when the daily Windows Home Server backup is running (i.e when I'm still asleep and not actively using the computer) and b) I'd like to know if there's any way to allow this program to run as admin so it doesn't keep interrupting me
    Solved!
    Go to Solution.

    You should be able to disable it in the LSC dashboard.  I will download LSC and locate it for you. 
    *edit*  Launch LSC>Dashboard View>Edit>Drag "Updates" or any unneeded item to the right "Events not monitored" section to disable.
    This document offers some other information on Lenovo Solution Center:
    http://support.lenovo.com/en_US/research/hints-or-tips/detail.page?&LegacyDocID=MIGR-74072#7
    Let us know if you have anymore questions.
    Did you find a post awesome? A great response? Kudo them!
    Did the post you read answer your question? Did someone help you figure out your problem? Hit Solution Provided and give that person a 'thank you' for helping you out!

  • Software Update runs every time I log in

    How do I stop software update from running every time I log in? I have it set to check for updates weekly (the default), but it starts up every time I log in.

    Welcome to Apple Discussions:
    It might be a corrupted .plist.
    First try this:
    Uncheck the box for checking for updates.
    Reboot
    See if the problem still occurs.
    If so, create a new temporary admin account and see if the problem occurs with the new user.
    Report back

  • How do I get my iTunes store to work? I have updated my iTunes to the latest version but every time I go to open it, it is just a blank white screen. No writing or anything. Help!?

    How do I get my iTunes store to work? I have updated my iTunes to the latest version but every time I go to open it, it is just a blank white screen. No writing or anything. Help!?

    Oh, and it is on a macbook pro

Maybe you are looking for