1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

preventing execution of same executable

Discussion in 'C' started by priyatendulkar, Mar 6, 2012.

  1. priyatendulkar

    priyatendulkar New Member

    Hi ,

    I have an executable say a.out.

    My requirement is that ..At a time only single instance of a.out be executed

    Is that possible in linux
     
  2. xpi0t0s

    xpi0t0s Mentor

    I don't think you can prevent the OS launching a second copy of the executable but you can make them detect each other. For example one way is to create a file lock when the executable starts, so if a second instance is launched, it would try to lock that file, fail, deduce from that that there is already someone else running and exit.
     
  3. priyatendulkar

    priyatendulkar New Member

    k..
    Thanx a lot for the response
     

Share This Page