Sponsored Content
Top Forums Programming Control multiple program instances - open multiple files problem Post 302494149 by hakermania on Saturday 5th of February 2011 04:28:39 PM
Old 02-05-2011
Network Control multiple program instances - open multiple files problem

Hello. This shouldn't be an unusual problem, but I cannot find anything about it at google or at other search machine.

So, I've made an application using C++ and QtCreator. I 've made a new mime type for application's project files.
My system (ubuntu 10.10), when I right click a file and I choose "Open With 'Default Application'" the it runs
Code:
default_application path/to/the/selected/file1

So, if you select multiple files and select "Open With 'Default Application'" the system will call
Code:
default_application path/to/the/selected/file1
default_application path/to/the/selected/file2
default_application path/to/the/selected/file3

So, this is a big problem for me, because I handle the concurrent processes from inside the program, so when another instance of the program is running, a warning message is appeared. So, each application's call will recognize the others as currently running applications and so it'll show the message. I'll end up with 3 Messages saying that another process of the program is running --_--'
My application handles multiple URLs this way:
Code:
myapp path/to/the/selected/file1 path/to/the/selected/file2 path/to/the/selected/file3

How can I make my code handle all these multiple instances at the same time? Everything I've tried fails, because everything I've tried requires a check from the first instance called, which is too slow and other instances come app and all together are warning about concurrent processes of the same program SmilieSmilieSmilie

So, how can I fix this? is it system depended, or can I do something with the code?
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

multiple instances of syslogd - is it possible?

I would like to start up multiple instances of syslog daemon. I am having a little difficulty. Is this at all possible? I have separate syslog.conf1.... syslog.conf5 files. I have linked the daemon to separate files syslogd1 ... syslogd5 I have arranged the rcd.2 start/stop scripts for... (9 Replies)
Discussion started by: Gary Dunn
9 Replies

2. UNIX for Dummies Questions & Answers

Multiple file instances

I am capturing text based reports with a specific program, which works no problem. However, since I send report warehouse output as they are migrated from the database software, on occasion when two capture process' initiate simultaneously, the capture file locks up. Is there a way to setup (in... (1 Reply)
Discussion started by: gozer13
1 Replies

3. Shell Programming and Scripting

detecting multiple instances

Hi Gurus I have a requirement like this. i use solaris OS.. if there are 2 instances of the same ksh file running in the directory, i need to kill the ksh file that started to run latest. suppose ragha.ksh starts running thru cron in abc/xyz directory now ragha.ksh started running by any... (3 Replies)
Discussion started by: ragha81
3 Replies

4. Shell Programming and Scripting

kill multiple instances of the same program

Hi, I know that the answer to this is very simple, since I saw somebody do it some time back..but I forgot how. The problem is, I have multiple instances of the same program running simultaneously and I want to kill them all in a single command. I know that it can be done using awk '{print... (12 Replies)
Discussion started by: ipzig
12 Replies

5. Shell Programming and Scripting

problem accessing Multiple Variables from C Program to a Shell script

program name--test #!/bin/bash output1=`/home/user/a.c` output2=`/home/user/a.c` k=`$output1 + 1` m=`$output2 + 1` echo $k echo $m --------------------------------------------------------------------------- prgram name--a.c #include<stdio.h> int main() (1 Reply)
Discussion started by: sameworld1980
1 Replies

6. Shell Programming and Scripting

Multiple instances of a job.

Could you please let me know how to create/make a multiple instances of a job/process in ksh(shell scripting). i.e., at present the parent script is calling another child/dependent script for only once. What we want is, the parent script itself has to execute multiple times, and in each one it... (1 Reply)
Discussion started by: Gangegowda
1 Replies

7. Shell Programming and Scripting

Perl, open multiple files with wildcards

I have a question regarding Perl scripting. If I want to say open files that all look like this and assign them to a filehandle and then assign the filehandle to a variable, how do I do this? The file names are strand1.fa.gz.tmp strand2.fa.gz.tmp strand3.fa.gz.tmp strand4.fa.gz.tmp ...... (6 Replies)
Discussion started by: japaneseguitars
6 Replies

8. Programming

Multiple instances of pthread

Suppose I declare pthread_t clear_thread; and then pthread_create(&clear_thread, &detach, clear_message, this); the thread is supposed to go away, perform the service it is intended to procide, and then kill itself. A little while later, I require this service again, so I say ... (2 Replies)
Discussion started by: clerew
2 Replies

9. Shell Programming and Scripting

open files with multiple indexes

Hi, I want to work with multiple files which all contain 2 numbers. I tried to make a nested for loop but for some reason it doesn't recognize the $j as a number. The output is cannot open file `175-T-pvalue.xls'. How do I make sure that it takes the numbers from the inner loop as $j? ... (4 Replies)
Discussion started by: linseyr
4 Replies

10. UNIX for Advanced & Expert Users

Pass Multiple Commands and Open Multiple Xterms via PSS

Hello, I'm attempting to open multiple xterms and run a command as an SAP user via sudo using PSSH. So far, I'm able to run PSSH to a file of servers with no check for keys, open every xterm in to the servers in the file list, and SUDO to the SAP(ADM) user, but it won't do anything else... (11 Replies)
Discussion started by: icemanj
11 Replies
RUN-MAILCAP(1)						       Run Mailcap Programs						    RUN-MAILCAP(1)

NAME
run-mailcap, view, see, edit, compose, print - execute programs via entries in the mailcap file SYNOPSIS
run-mailcap --action=ACTION [--option[=value]] [MIME-TYPE:[ENCODING:]]FILE [...] The see, edit, compose and print versions are just aliases that default to the view, edit, compose, and print actions (respectively). DESCRIPTION
run-mailcap (or any of its aliases) will use the given action to process each mime-type/file in turn. Each file is specified as its mime- type, its encoding (e.g. compression), and filename together, separated by colons. If the mime-type is omitted, an attempt to determine the type is made by trying to match the file's extension with those in the mime.types files. If the encoding is omitted, it will also be determined from the file's extensions. Currently supported encodings are gzip (.gz), bzip (.bz), bzip2 (.bz2), and compress (.Z). A file- name of "-" can be used to mean "standard input", but then a mime-type must be specified. Both the user's files (~/.mailcap; ~/.mime.types) and the system files (/etc/mailcap; /etc/mime.types) are searched in turn for informa- tion. EXAMPLES see picture.jpg print output.ps.gz compose text/html:index.htm extract-mail-attachment msg.txt | see image/tiff:gzip:- OPTIONS All options are in the form --<opt>=<value>. --action=<action> Performs the specified action on the files. Valid actions are view, cat (uses only "copiousoutput" rules and sends output to STD- OUT) , compose, composetyped, edit and print. If no action is specified, the action will be determined by how the program was called. --debug Turns on extra information to find out what is happening. --nopager Ignores any "copiousoutput" directive and sends output to STDOUT. --norun Displays the found command without actually executing it. SEE ALSO
update-mime(8) AUTHOR
run-mailcap (and its aliases) was written by Brian White <bcwhite@pobox.com>. COPYRIGHT
run-mailcap (and its aliases) is in the public domain (the only true "free"). Debian Project 1st Jan 2008 RUN-MAILCAP(1)
All times are GMT -4. The time now is 07:28 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy