Sponsored Content
Top Forums Programming How to create constantly running process Post 302086211 by bhakti on Wednesday 23rd of August 2006 01:48:19 AM
Old 08-23-2006
How to create constantly running process

Ther are two process in my program and i want both to constantly running. So i have written the following code. But one of this process which is calling function wsJobCheck() is getting terminated with giving message : Program exited normally.

Can any one suggest why this is happing.
Code :

Code:
#include"listen_to_ms.h"
#include"job_header.h"  /*all headers files are included in this header file*/
#include"ws_job_check.h"

extern void callWSJobCheck(int);
int main()
{

    /* declaration */
    pid_t childpid;
    int j=0;
    struct passwd *pwd;
   
   
    /* creating a new child process */
    childpid=fork();
    if(childpid==0)
    {
        /* crete processes for listening to WS */
        listenToMS();
        exit(0);
    }

    if(signal(SIGALRM,callWSJobCheck)==SIG_ERR)
    {
        fprintf(stderr, "\nIN MAIN FUNCTION       :     Error in SIGALRM\n");
    }
    else
    {
        alarm(20);
    }


    return 0;
}


void callWSJobCheck(int signal)
{
    wsJobCheck();
    alarm(10);
    printf("\nIN MAIN FUNCTION       :     signal : %d",signal);
}

I am working on AIX os.

Last edited by blowtorch; 08-23-2006 at 10:27 AM.. Reason: to put in code tags...
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

How to create a dummy process of a process already running?

Hi Everybody, I want to create a shell script named as say "jip" and it is runned. And i want that when i do ps + grep for the process than this jip should be shown as process. Infact there might be process with name jip which is already running. (3 Replies)
Discussion started by: shambhu
3 Replies

2. UNIX for Advanced & Expert Users

how to create a process

Hell Sir, This is chanikya Is there any System call which behaves just like fork but i dont want to return back two times to the calling func. In the following ex iam creating a child process in the called func but the ex prints two times IN MAIN. ex :- calling() { fork(); } main()... (4 Replies)
Discussion started by: chanikya
4 Replies

3. Shell Programming and Scripting

script to monitor process running on server and posting a mail if any process is dead

Hello all, I would be happy if any one could help me with a shell script that would determine all the processes running on a Unix server and post a mail if any of the process is not running or aborted. Thanks in advance Regards, pradeep kulkarni. :mad: (13 Replies)
Discussion started by: pradeepmacha
13 Replies

4. Shell Programming and Scripting

Create a html file if a process is running??

Hi All, I need to check for a process, if the process is running then I have to create an HTML file, say A.HTML. If the process is not running then I have to rename the existing html, say A.HTML to B.HTML so that the process which looks for the file A.HTML does not find it? How do I do... (1 Reply)
Discussion started by: Hangman2
1 Replies

5. UNIX for Dummies Questions & Answers

Running different process from current process?

I have been having some trouble trying to get some code working, so I was wondering...what system calls are required to execute a different program from an already running process? (1 Reply)
Discussion started by: Midwest Product
1 Replies

6. UNIX for Dummies Questions & Answers

How a process can check if a particular process is running on different machine?

I have process1 running on one machine and generating some log file. Now another process which can be launched on any machine wants to know if process1 is running or not and also in case it is running it wants to stream the logs file generated by process1 on terminal from which process2 is... (2 Replies)
Discussion started by: saurabhnsit2001
2 Replies

7. BSD

Process remians in Running state causing other similar process to sleep and results to system hang

Hi Experts, I am facing one problem here which is one process always stuck in running state which causes the other similar process to sleep state . This causes my system in hanged state. On doing cat /proc/<pid>wchan showing the "__init_begin" in the output. Can you please help me here... (0 Replies)
Discussion started by: naveeng
0 Replies

8. UNIX for Advanced & Expert Users

Process remians in Running state causing other similar process to sleep and results to system hang

Hi Experts, I am facing one problem here which is one process always stuck in running state which causes the other similar process to sleep state . This causes my system in hanged state. On doing cat /proc/<pid>wchan showing the "__init_begin" in the output. Can you please help me here... (1 Reply)
Discussion started by: naveeng
1 Replies

9. UNIX for Advanced & Expert Users

Process remians in Running state causing other similar process to sleep and results to system hang

Hi Experts, I am facing one problem here which is one process always stuck in running state which causes the other similar process to sleep state . This causes my system in hanged state. On doing cat /proc/<pid>wchan showing the "__init_begin" in the output. Can you please help me here... (6 Replies)
Discussion started by: naveeng
6 Replies

10. Shell Programming and Scripting

Command to get exact tomcat process I am running ignoring other java process

Team, I have multiple batchjobs running in VM, if I do ps -ef |grep java or tomcat I am getting multiple process list. How do I get my exact tomcat process running and that is unique? via shell script? (4 Replies)
Discussion started by: Ghanshyam Ratho
4 Replies
setpgrp(2)							System Calls Manual							setpgrp(2)

NAME
setpgrp - set process group ID SYNOPSIS
DESCRIPTION
If the calling process is not already a session leader, sets the process group ID of the calling process to the process ID of the calling process. If creates a new session, then the new session has no controlling terminal. The function has no effect when the calling process is a session leader. Security Restrictions Some or all of the actions associated with this system call may require privileges. See privileges(5) for more information. RETURN VALUE
Upon successful completion, returns the new process group ID. ERRORS
If fails, no changes occur and (see errno(2)) is set to one of the following values: The calling process is already a process group leader or the process group ID of a process other than the calling process matches the process ID of the calling process. The calling process does not have sufficient privileges. SEE ALSO
exec(2), fork(2), getpid(2), getsid(2), kill(2), setpgrp3(2), setsid(2), privileges(5), <unistd.h>. STANDARDS CONFORMANCE
setpgrp(2)
All times are GMT -4. The time now is 11:02 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy