Sponsored Content
Top Forums Programming how to programing daemon to create log record every second Post 302606587 by techmonk on Monday 12th of March 2012 06:25:15 AM
Old 03-12-2012
Code:
static int  i;
main()
{
    char *buf;
    daemonize();
    while(1)
    {
        buf = malloc(10*sizeof(char));
    
        sprintf(buf,"%d",i);
        
        log_message(LOG_FILE,buf);

        free(buf);
    
        i++;
        
            sleep(1); /* run */
    }
}

 

10 More Discussions You Might Find Interesting

1. UNIX Desktop Questions & Answers

Graphics programing

Hi all! I`m new in Unix (Linux) and i whant to ask something! What language should i use for Linux developing.I meen applications an GAME DEVELOPING! Should i use C,TCL ??? Please help me on this ...:( (1 Reply)
Discussion started by: Sebastyan
1 Replies

2. Programming

log daemon

How does a log daemon work? If I'm upto write on, how should I design it? for example a syslog daemon, how should I make my daemon so that it gets things that hapends in the system? Or does every program have to call the daemon to log? please no answers about reading code, I'w tryed and... (0 Replies)
Discussion started by: Esaia
0 Replies

3. Shell Programming and Scripting

Removing Carriage return to create one record

I have a file with multiple records in it and want to create a single record by removing all the carriage returns, is there a sed command or another command that will easily allow this to happen. current layout 813209A 813273C 812272B expected result 813209A813273C812272B previously I... (3 Replies)
Discussion started by: r1500
3 Replies

4. UNIX for Advanced & Expert Users

How to see record for particular date from a log file

Hi Experts, I 'm a Oracle Dba, everytime if have to see the alert log file. I used tail command to see the last few line of the log file. I wished if i could see record for the particular date(e.g nov 23), here is sample log file. Wed Nov 28 21:43:59 2007 Control autobackup written to... (5 Replies)
Discussion started by: shaan_dmp
5 Replies

5. Shell Programming and Scripting

Awk Programing (need help)

plx help to solve these problems?? 1. Create a HERE document which will edit multiple files in the same directory, using the ed editor. I give you 3 original files: file1.c , file2.c , file3.c, download them and change each string "stdio.h" to "STDIO.H" in these files. Note: when execute the... (1 Reply)
Discussion started by: SoCalledEngr
1 Replies

6. UNIX for Dummies Questions & Answers

Create file with fixed record size

Hello all, Linux - Is there any way of creating a new file and determining its record size upon creation? open() and creat() do not refer to record size. Thanks... (2 Replies)
Discussion started by: klafte
2 Replies

7. Shell Programming and Scripting

shell programing...

Hi... i need to write a shell script wich shows the full name and station of every logged user in the system. pls help! (1 Reply)
Discussion started by: relu89
1 Replies

8. Programming

Unicode programing in C

im starting to go a little serious with c, woking in a personal project that will read a xml, which might contain Unicode characters (i know it will on my system, which is set to es_AR.UTF-8) im using mxml, and the documentation says it uses utf8 internally (no worries here). so i need to be... (4 Replies)
Discussion started by: broli
4 Replies

9. UNIX for Dummies Questions & Answers

How to Create a new internal DNS CNAME record

I need to create a new internal DNS CNAME record called "project.omc.eod" that points to a server called SPARC27.ds.eod. This is my first time doing this and any help would be greatly appreciated. Thanks in advance (10 Replies)
Discussion started by: mikeade
10 Replies

10. Linux

Corrupted daemon.log file

hi, yesterday I made something wrong and deleted daemon.log file. Then created a new file with the same name under the same path but now, it seems that file constructed has been corrupted . In earlier times, it was including regex name. Now there is no regex name. This is the current... (0 Replies)
Discussion started by: baris35
0 Replies
CTERMID(3)						   BSD Library Functions Manual 						CTERMID(3)

NAME
ctermid, ctermid_r -- generate terminal pathname LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <stdio.h> char * ctermid(char *buf); char * ctermid_r(char *buf); DESCRIPTION
The ctermid() function generates a string, that, when used as a pathname, refers to the current controlling terminal of the calling process. If buf is the NULL pointer, a pointer to a static area is returned. Otherwise, the pathname is copied into the memory referenced by buf. The argument buf is assumed to be at least L_ctermid (as defined in the include file <stdio.h>) bytes long. The ctermid_r() function provides the same functionality as ctermid() except that if buf is a NULL pointer, NULL is returned. The current implementation simply returns '/dev/tty'. RETURN VALUES
The ctermid() function returns buf if it is non-NULL, otherwise it returns the address of a static buffer. The ctermid_r() function always returns buf, even if it is the NULL pointer. ERRORS
The current implementation detects no error conditions. SEE ALSO
ttyname(3) STANDARDS
The ctermid() function conforms to IEEE Std 1003.1-1988 (``POSIX.1''). BUGS
By default the ctermid() function writes all information to an internal static object. Subsequent calls to ctermid() will modify the same object. BSD
October 1, 2011 BSD
All times are GMT -4. The time now is 02:38 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy