I have made a shell that accept a command and parameters. It is working properly. I have tryed to implement background process in main(). But i dont know to implement them. Can anyone give me a lille example??
Hello all,
How do I start a background process and save the process id to a file on my system. For example %wait 5 & will execute and print the process id. I can't figure out how to get it to a file. I've tried: > filename 0>filename 1>filename.
Any assistance is most appreciated.
Thanks,
Jim... (10 Replies)
Hi Guys,
I am facing some weird problem with my shell script. The script shows up a menu and for every ontion internally calls a shell script which start/stop various servers. When I am using '&' while calling the internal shell script so that the server run in the background. For exiting... (1 Reply)
Hi,
In shell script when I use
script1 >> filelog
the echo statments of script1 gets printed in the filelog
but when I try to run script in background i.e,
script1 & >> filelog
nothing gets printed in the filelog.
Anybody knows whats going on here.
thanks (3 Replies)
Hi,
I have a main script(main.ksh) within which I have called another script(sub.ksh). The sub.ksh script is made to run in the background using '&'. The main.ksh script logs the information in a logfile main_ddmmyy and the sub.ksh script also logs the information in the log file sub_ddmmyy.... (5 Replies)
I need to submit a script that will continue to run after logging out and after a reboot or shutdown.
I entered the following: nohup script &
The script continues to run in the background after logging off the system but is killed after a reboot or shutdown. Any help would be greatly... (1 Reply)
What I need to learn is how to use a script that launches background processes, and then kills those processes as needed.
The script successfully launches the script. But how do I check to see if the job exists before I kill it?
I know my problem is mostly failure to understand parameter... (4 Replies)
Hi,
I am using net::ftp for transferring files now i am trying in the same Linux server as a result ftp is very fast but if the server is other location (remote) then the file transferred will be time consuming.
So i want try putting FTP part as a background process. I am unaware how to do... (5 Replies)
Hi,
I have written a menu driven shell script in which as per the choice, I run the another script on background.
For eg:
1. get info
2)process info
3)modify info
All the operations have different scripts which i schedule in background using &.
However I wish to display the error... (0 Replies)
Discussion started by: ashima jain
0 Replies
LEARN ABOUT MOJAVE
setttyent
GETTTYENT(3) BSD Library Functions Manual GETTTYENT(3)NAME
getttyent, getttynam, setttyent, endttyent -- get ttys file entry
LIBRARY
Standard C Library (libc, -lc)
SYNOPSIS
#include <ttyent.h>
struct ttyent *
getttyent(void);
struct ttyent *
getttynam(const char *name);
int
setttyent(void);
int
endttyent(void);
DESCRIPTION
The getttyent(), and getttynam() functions each return a pointer to an object, with the following structure, containing the broken-out fields
of a line from the tty description file.
struct ttyent {
char *ty_name; /* terminal device name */
char *ty_getty; /* command to execute, usually getty */
char *ty_type; /* terminal type for termcap */
#define TTY_ON 0x01 /* enable logins (start ty_getty program) */
#define TTY_SECURE 0x02 /* allow uid of 0 to login */
#define TTY_DIALUP 0x04 /* is a dialup tty */
#define TTY_NETWORK 0x08 /* is a network tty */
int ty_status; /* status flags */
char *ty_window; /* command to start up window manager */
char *ty_comment; /* comment field */
char *ty_group; /* tty group name */
};
The fields are as follows:
ty_name The name of the character-special file.
ty_getty The name of the command invoked to initialize tty line characteristics.
ty_type The name of the default terminal type connected to this tty line.
ty_status A mask of bit fields which indicate various actions allowed on this tty line. The possible flags are as follows:
TTY_ON Enables logins
TTY_SECURE Allow users with a uid of 0 to login on this terminal.
TTY_DIALUP Identifies a tty as a dialin line.
TTY_NETWORK Identifies a tty used for network connections.
ty_window The command to execute for a window system associated with the line.
ty_group A group name to which the tty belongs. If no group is specified in the ttys description file, then the tty is placed in an
anonymous group called "none".
ty_comment Any trailing comment field, with any leading hash marks (``#'') or whitespace removed.
If any of the fields pointing to character strings are unspecified, they are returned as null pointers. The field ty_status will be zero if
no flag values are specified.
See ttys(5) for a more complete discussion of the meaning and usage of the fields.
The getttyent() function reads the next line from the ttys file, opening the file if necessary. The setttyent() function rewinds the file if
open, or opens the file if it is unopened. The endttyent() function closes any open files.
The getttynam() function searches from the beginning of the file until a matching name is found (or until EOF is encountered).
RETURN VALUES
The routines getttyent() and getttynam() return a null pointer on EOF or error. The setttyent() function and endttyent() return 0 on failure
and 1 on success.
FILES
/etc/ttys
SEE ALSO login(1), ttyslot(3), gettytab(5), termcap(5), ttys(5), getty(8),
HISTORY
The getttyent(), getttynam(), setttyent(), and endttyent() functions appeared in 4.3BSD.
BUGS
These functions use static data storage; if the data is needed for future use, it should be copied before any subsequent calls overwrite it.
BSD November 17, 1996 BSD