Detecting the name of a running script

Hello,
if I code something like this
#!/sbin/sh
# do anything
# source in another script
. /tmp/include.sh
Is there any change to detect inside of /tmp/include.sh that /tmp/include.sh is running?
($0 still has the old value)
TIA
Bernd

I think this may be a little difficult. When a script
is dotted (. <script>), it executes in the environment of
the current script. It does not fork off a new process so
there is no new $0.
Have you considered using some type of flag in the environment? Something like:
RUNNING=include.sh
. /tmp/include.sh
unset RUNNING
Then in include.sh, check for RUNNING. Not an ideal solution, but could work...

Similar Messages

  • Photoshop opens itself the help page while running script

    Hello everyone.
    I have a script that works for hours, and I noticed that sometimes (about 1 time per hour, but it varies) Photoshop opens itself the browser to display the help page.
    Anyone know what can cause this?
    Thank you in advance for your answers.

    Here is my script:
    http://pastebin.com/j0Sp9u5K
    But I do not think my code is the cause ...
    I would like to share another concern.
    So my script works for hours, and despite the use of the command "app.purge (PurgeTarget.ALLCACHES)" Photoshop eventually crash putting me the message "Not enough memory to preview" (I do not know the exact message in English, I have a French version).
    There is no error code, and I tried to isolate my loop in a try / catch, but even so the error is crashing my script.
    I turned off the preview of the layers in the Layers palette, the script runs a little longer, but still ends by crashing.

  • How do i get the value in a variable that I don't know the name of til run

    I have a record type( pr_team) defined in a package - anchored to a table.
    I want to be able to go through each of the fields in it one at a time. I get the list of fields from the table definition from cursor as follows
    CURSOR c_fields IS
    SELECT column_name
    FROM all_tab_cols
    WHERE owner = 'CDS'
    AND table_name = 'TEAM';
    r_fields c_fields%ROWTYPE;
    So first returned value is team_id
    how can I get this value when all I know the field name is 'pr_team.' || r_fields.column_name
    cheers
    Simon

    Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
    SQL> CREATE OR REPLACE PACKAGE package_name
      2  AS
      3     r_emp emp%ROWTYPE;
      4  END package_name;
      5  /
    Package created.
    SQL> SET SERVEROUTPUT ON SIZE UNLIMITED;
    SQL> DECLARE
      2     v_empno emp.empno%TYPE;
      3     v_ename emp.ename%TYPE;
      4  BEGIN
      5     SELECT *
      6     INTO   package_name.r_emp
      7     FROM   emp
      8     WHERE  ROWNUM = 1;
      9
    10     EXECUTE IMMEDIATE
    11        'BEGIN ' ||
    12        '   :v_empno := package_name.r_emp.empno; ' ||
    13        '   :v_ename := package_name.r_emp.ename; ' ||
    14        'END;'
    15        USING OUT v_empno, OUT v_ename;
    16
    17     DBMS_OUTPUT.PUT_LINE ('v_empno => ' || v_empno);
    18     DBMS_OUTPUT.PUT_LINE ('v_ename => ' || v_ename);
    19  END;
    20  /
    v_empno => 7369
    v_ename => SMITH
    PL/SQL procedure successfully completed.
    SQL>

  • [solved!] Running a command to detect the current resolution of X?

    I want to write a script that detects the resolution I'm running and echo it to a configuration file.  I've heard of xrandr, but when I run it, I get ...
    [max@pwn rigsofrods]$ xrandr
    Xlib: extension "RANDR" missing on display ":0.0".
    RandR extension missing
    This script will be a part of a PKGBUILD, so I'm hoping there's something really simple and seamless that I could use for just about anyone's computer regardless of configuration.
    Last edited by synthead (2008-12-24 00:33:27)

    Haha.  I made a better solution with the PKGBUILD, actually   Rigs of Rods isn't the "smartest" linux game so lots of configs are in the program directory.  Just like any other big game, I put it in /opt, so there were a lot of permission issues and complications when regular users tried to configure the game.  What I ended up doing is replacing the blank config it comes with with a very basic 800x600 windowed configuration, and if a user runs RoR, a little script makes a hidden folder and copies it to it.  From there, that section of the configuration utility edits the ~/.rigsofrods configuration   And as you would expect, its in plaintext, so you can edit it by hand too.
    But not ignoring all the other configs that have to be in /opt/rigsofrods, I made a group called "ror" that allows rw access to config files and allows you to fully configure the game.

  • Detecting server name in java

    I need to programmatically detect the name or ip of the server my java code is running on. Does anyone know how to do this?
    Thanks,
    -G

    If you are not behind a router, this code work well:
    import java.net.*;
    import java.util.Enumeration;
    public static InetAddress getInternetAddress()
         try
              InetAddress address;
              for(Enumeration e1 = NetworkInterface.getNetworkInterfaces(); e1.hasMoreElements();)
                   for(Enumeration e2 = ((NetworkInterface)(e1.nextElement())).getInetAddresses(); e2.hasMoreElements();)
                        address = (InetAddress)e2.nextElement();
                        if( !address.isLoopbackAddress() && !address.isSiteLocalAddress() )
                             return address;
         }catch(Exception e){}
         return null;
    }

  • Run script "void(0)"  I need help to stop this happening !

    When I am doing online banking with NatWest (UK) exactly that message appears in my progress bar (bottom left of browser window) when I click on the name of any of my three accounts.
    Normally, clicking should expand a submenu listing all recent transactions but for about a week now, it has stopped working. Instead, that's the message I get:
    run script "void(0)"
    The people at the bank say there's no problem and that it works for them.
    So what's the cause of this issue and how can I fix it?
    BTW Javascript is on and I have not recently altered any settings in Safari. I regularly flush out all browser caches.

    I can't seem to access that info, Andy. There is no "Inspect Element" option. There is a "view frame source" option which opens a window containing tons and tons of code. I can't copy/paste the exact code here because it scripts itself here and doesn't display the way I see it (if that makes sense).
    Note: I encounter the exact same issue in Safari, Firefox, and Opera. I am using the latest versions of all 3 browsers.
    The techie guy from NatWest just called me and we were on the phone for about half an hour. He paid for the call.
    We went through various routines with different browsers including a stripped-down version of Firefox with all add-ons disabled. The same problem kept coming up and I emailed him a screen shot of what I'm getting.
    He's completely stumped and has escalated the problem by sending it up to Level 2. They will try to reproduce the issue using a setup identical to mine (10.6.6., Safari 5.0.3).
    Level 2 may then call me again on Monday or Tuesday. Watch this space....

  • Flash player update causing IE browsing delays due to long running script

    Hi
    Can anyone help with this problem please: Flash player update causing IE browsing delays due to long running script. When I go to Google accounts or google anayltics long running script sometimes stops the loading of the google sites and the message appreas
    long running script preventing loading
    What in the name of God is this
    PP

    Hi Mokhtar,
    Thanks for your reply.
    I referred the scripts as below I master page and added .Js files in layouts directory inder 1033 folder.
    <SharePoint:ScriptLink ID="jQuery164" runat="server" Name="jquery-1.6.4.js" LoadAfterUI="true" OnDemand="false"/>
       <SharePoint:ScriptLink ID="SPUtility1" runat="server" Name="spjs-utility.js" LoadAfterUI="true" OnDemand="false"/>
       <SharePoint:ScriptLink ID="SuperFish" runat="server" Name="superfish.js" LoadAfterUI="true" OnDemand="false"/>
       <SharePoint:ScriptLink ID="SuperFishSP" runat="server" Name="SuperfishForSharePoint.js" LoadAfterUI="true" OnDemand="false"/>
    still the issue is not resolved.
    Is there any changes I've to do

  • Run scripts on a schedule

    Is the a way to run scripts on a schedule? I have a script that I want to run 3 days (Mon, Wed, Fri) a week at a certain time.
    How can I do this

    lets use iCal seeing as it came with your mac.
    create your script and save it where ever you want, open iCal create a new event, on the right hand side you will see the new events draw, set the time you want your script to activate in the from-to area, set it to repeat and end as you wish, go down to alarm and select open file in the drop down, then right below open file their should be another drop down select other from that, that will open a window now select your script, then in the next drop down select on date, your done.
    let me no if you need any more help.
    Budgie

  • Flash restricted running scripts or activeX controls

    Hey, can someone give me a hand?
    I read in a different, older forum, that said to use "<!--
    saved from url=(0014)about:internet -->" but how do i put it
    into my flash projects?
    If this is not what i should use then what should i use to
    remove the sign "flash restricted running scripts or activeX
    controls" that pops up when i run the flash on my website.

    I thought that only happened when running flash
    locally.

  • Is there a way to have your PS script Query the name of your local Mail Server?

    Hey Guys, 
      Really hoping someone can help me out here. I am currently working on a script that Automates the entire user creation process (AD account, Exchange Mailbox, UCM Soft phone). I want this script to be universal for all systems I have to work with.
    By this I mean that I can run the script on various systems (Different Domains) without ever having to modify the code. 
      I have run into a bit of a problem while trying to automate the PSSession component of my script. I would like to be able to run he script and it inserts the relevant Mail server name based on some sort of Lookup or query. I am currently circumventing
    the issue by having a text box pop up asking for the mail server name. It works, but its not really what I want for the end product. Its frustrating seeing as I have overcome similar issues for things like UPNs, AD Server, etc....
       I have though about having it pull from the DNS MX records, but there are a number of different records for different Mail servers.
      Any help would be awesome!

    Notice that this has drifted a whole long way from the original question.  I pointed out that it is easy with Exchange but if the servers are in different companies or are not part of an enterprise deployment then you need to look at the local AD and
    seek to the top. Any one mailbox wwil get you an exchange server to remote into and use the exchange shell to discover the network.
    ¯\_(ツ)_/¯
    Looking back over the thread, that may be my fault.  I mistook the comment about checking MX to mean he's just looking for a mail relay. 
    [string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "

  • Updating my script to add in the Name of the VM in VMM

    Hello,
    I run the following script from our VMM server and it's working well in that it gives me the location of the folder where the VM lives and whether or not the VM is fixed or dynamic (or a checkpoint).
    But what's missing is I want to add in the Name of the VM that this location belongs too.  The $_.Name gives me the name of the .vhd file...but in some cases the name of the .vhd files is just Cdrive or Ddrive. 
    $results = @()
    $VMs = Get-SCVirtualMachine
    Get-SCVirtualMachine | Get-SCVirtualHardDisk | foreach-object {
    $results += New-Object PsObject -Property @{
    Name = $_.Name
    Location = $_.Location
    VHDType = $_.VHDType
    $Results | Export-Csv -NoTypeInformation "C:\Powershell_Scripts\results.csv"
    Thank you.

    Hi Greavette,
    To add the vm name column in the output, please refer to this script, please note I haven't tested:
    $results = @()
    $VMs = (Get-SCVirtualMachine).name #get all vm names
    foreach-object($vm in $vms){
    Get-SCVirtualHardDisk -VM $vm | foreach-object {
    $results += New-Object PsObject -Property @{
    VM = $vm
    Name = $_.Name
    Location = $_.Location
    VHDType = $_.VHDType}
    $Results | Export-Csv -NoTypeInformation "C:\Powershell_Scripts\results.csv"
    If there is anything else regarding this issue, please feel free to post back.
    Best Regards,
    Anna Wang

  • How to return the name (or ID) of the Task FLow in Script

    Sitaution; two task flows created which can be accessed via Tools > TaskFlows within FDQM
    Task Flow "1.1 Multi Load - Import" --> Should run Batch Process Up to Import (enmBatchProcessLevel: 2)
    Task Flow "2.1 Multi Load - Import Up To Validate" --> Should run Batch Process Up to Validate (enmBatchProcessLevel: 4)
    I have developed one generic script which I would like to use for each task flow.
    Only the enmBatchProcessLevel differs between the task flows and therefore I would like to parse this enmBatchProcessLevel as a parameter my generic script.
    To be able to do this, the script needs to know on which task flow a user has clicked. So, I am looking for a function or statement which returns the name (or ID) of the task flow. Based on this name (or ID) a conditional statement can be performed in which a variable is dynamically filled. This variable can then be parsed as a parameter to my generic script.
    For instance:
    Sub GenericRoutine
         Dim strTaskFlow
         Dim intBatchProcessLevel
         '--Get the Task Flow Name
         strTaskFlow = ......<How to return the TaskFlow name or ID?>
         '--Validate the task flow and fill variable intBatchProcessLevel dynamically
         Select Case strTaskFlow
              Case "1.1 Multi Load - Import"
                   intBatchProcessLevel = 2
              Case "2.1 Multi Load - Import Up To Validate"
                   intBatchProcessLevel = 4
         End Select
         '--Execute generic script
         '--Call Batch script and parse intBatchProcessLevel as a parameter:
         Call sBatchProcess(intBatchProcessLevel)
         '--Execute generic script
    End Sub
    Sub sBatchProcess(Byval intBatchProcessLevel)
         Dim lngProcessLevel
         Dim strDelimiter
         Dim blnAutoMapCorrect
         '--Use intBatchProcessLevel to fill lngProcessLevel
         lngProcessLevel = intBatchProcessLevel
         strDelimiter = "_"
         blnAutoMapCorrect = 0
         Set BATCHENG.PcolFiles = BATCHENG.fFileCollectionCreate(CStr(strDelimiter))
         BATCHENG.mFileCollectionProcess BATCHENG.PcolFiles, CLng(lngProcessLevel), , CBool(blnAutoMapCorrect)
    End Sub
    Edited by: user13642656 on Jul 21, 2011 4:55 AM

    Hi, thanks for your reply.
    The Generic script contains 600+ records, which I would like to maintain once, when having multiple Task Flows for Import, UpToValidate, ValidateOnly, UpToExport, ExportOnly etc.
    Is there a central storage in FDQM workbench for script, like a "Module" in Excel VisualBasic environment? Thanks!

  • How to detect the number of marker (cuepoitName) with same name from a list.

    ... it is the second step of my previous question.
    From a sound I take a list of cuepointName with different name, for exemple:
    Mylistcuepoint =  ["reg 01", "reg 2", "name 1, "name 2", "name  3"] etc.
    Which command I must use to detect the cuePointTime only for the cuepointName: "name 1", "name 2" "name 3" ...
    My second question, for a second script is: how can I count how many  cuePointName with "name 1", "name 2", "name ...." I have in "Mylistcuepoint"?
    I can load several sound member so "Mylistcuepoint" can change obviously for the number of marker of "reg ...." and for the number of marker of "name ...." but the first word ("reg" or "name") it will be always the same.
    Tanks

    From a sound I take a list of cuepointName with different name, for exemple:
    Mylistcuepoint =  ["reg 01", "reg 2", "name 1, "name 2", "name  3"] etc.
    Which command I must use to detect the cuePointTime only for the cuepointName: "name 1", "name 2" "name 3" ...
    I already showed you how to do this in response to your last question.
    My second question, for a second script is: how can I count how many  cuePointName with "name 1", "name 2", "name ...." I have in "Mylistcuepoint"?
    It is a list like any other. Iterate through the items looking to see if they match your criterion/criteria and increment your found count (or add indices to a list) as you go:
    tSearch = "name 1"
    tFoundCount = 0
    Mylistcuepoint =  ["reg 01", "reg 2", "name 1, "name 2", "name  3"]
    if Mylistcuepoint.getPos(tSearch) then
      repeat with nn = 1 to count(Mylistcuepoint)
        if ( Mylistcuepoint[nn] = tSearch ) then tFoundCount = tFoundCount +1
      end repeat
    end if

  • "No Content-Type in the header" running script

    I get the following exception when trying to run a script from within iSQL*Plus...
    -- Internal error (No Content-Type in the header)
    Any suggestions?

    Alison,
    The Oracle/Apache web server is running on the same machine as the client. I am able to connect to iSQL*Plus using Netscape Navigator. I am also able to run queries by typing it in the text area. I get the "no content" exception only when I try to run a script by typing in a path and script name (including the .sql extension) into the script location field and executing it by pressing the "run script" button. I also get the same exception if I find a script using the "browse" button and running it.
    This functionality works fine in IE.
    null

  • Script needed to detect the Ora-03113

    Hello All,
    We are facing strange problem in our customer testbed.
    Oracle sporadically stop working with ora-03113 "End of communication channel".
    To prevent the problem we have to restart the machine.
    Is it possible to schedule a scripts which will detect the ora-03113 and restart the Oracle service. So that we don't have huge downtime during night when nobody is monitoring the machine.
    Note: Oracle version 9i in windows 32 bit. The problem recovered automatically within 30 min (approx) if machine is not rebooted.
    Thanks
    With Regards
    Hemant.

    Oracle Enterprise Manager (comes free with Oracle) can monitor the alert, generate an event, and run a fixit script to reboot the database.
    It only requires some installation and some reading, but no homegrown scripts are required.
    Sybrand Bakker
    Senior Oracle DBA
    Experts: those who did read the documentation

Maybe you are looking for