Sponsored Content
Top Forums Shell Programming and Scripting Alternative network messaging? Post 302721601 by DGPickett on Thursday 25th of October 2012 02:53:23 PM
Old 10-25-2012
Yes, kill is named for it's most popular use, termination, but it is just a signal sender.

in shell, trap is the shell signal catcher. SIGINT was available, but for apps SIGUSR1 and SIGUSR2 are most appropriate: Man Page for signal (linux Section 7) - The UNIX and Linux Forums

The signal processing is done out of sequence with the process thread(s), but in the same process so variables are passed.

So, you can push files to input-dir/unique.take-me-extension, the final step being mv and then kill to start the possibly, usually sleeping server so it processes the input.(
Code:
ssh server_host 'cat >input-dir/unique.take-me-extension.tmp
  mv input-dir/unique.take-me-extension.tmp input-dir/unique.take-me-extension
  kill -SIGUSR1 `< server-pid-file`
 ' < input-file

Of course, you have to be the same id or root to signal a process. Named pipes can stall servers that only require the writer have permission on the pipe.
Code:
$ mknod p p
$ ls -lA|grep '^p'
prw-r--r--   1 my_uid    my_group          0 Oct 25 14:54 p
$ while :
do
 cat <p
done &
[1]     19299
$ echo hi >p
$ hi
echo hello >p
$ hello


Last edited by DGPickett; 10-25-2012 at 04:01 PM..
This User Gave Thanks to DGPickett For This Post:
 

6 More Discussions You Might Find Interesting

1. Programming

Instant Messaging App Help

I was hoping someone could assist me on a text-based instant messaging client(using UDP) I am working on. I have the network communication basics already in place but, specifically, needed some further help on the "messaging other users" and "getting a user list" functions. The server code that... (0 Replies)
Discussion started by: AusTex
0 Replies

2. IP Networking

DT messaging could not be started

this id the message i get with a suggestions to check those files: /etc/src.sh /etc/hosts /usr/adm/inetd.sec i have little knowledge of hoe to edit those files/ i went to the etc library and didn't found src.sh file. what should i do? also didn't find the inetd.sec file In the host... (3 Replies)
Discussion started by: amirp
3 Replies

3. UNIX and Linux Applications

how do i enable messaging

hi guyz i work as a system administrator for some organization(am a newbie). one of the solaris machines is loaded with the messenger server...all configured by a former administrator. my task was to create user accounts for the mail and calendar services and as i checked its not working .....i... (0 Replies)
Discussion started by: henokia4j
0 Replies

4. Programming

problems while using messaging queues....

hi I am using posix functions such as mq_open, mq_close and including the mqueue.h. but its giving a linking error,"undefined reference to mq_open and mq_close". it it that we have to link some library or so while compiling... plzzz help Thanxs Mohit (0 Replies)
Discussion started by: mohit3884
0 Replies

5. UNIX for Advanced & Expert Users

The DT messaging system could not be started

Hello All, I am getting " The DT messaging system could not be started" message when wants to login as root on a box running on tru64 5.1A. /etc/hosts is ok. when i see in .dt/errorlog it shows message server could not be started. Thanks for help. Awadhesh (2 Replies)
Discussion started by: Awadhesh
2 Replies

6. Shell Programming and Scripting

The DT messaging system could not be started.

Good Morning, Users can no longer log into SunBlade 2500 Solaris 9 system (though root still can). Here's what I'm getting and what I've done. I'm most suspicious of the full drive since that pops up twice and I did see one looks full. What's a good way to reduce what's on it?- or.. what else... (2 Replies)
Discussion started by: Stellaman1977
2 Replies
KILL(2) 						     Linux Programmer's Manual							   KILL(2)

NAME
kill - send signal to a process SYNOPSIS
#include <sys/types.h> #include <signal.h> int kill(pid_t pid, int sig); Feature Test Macro Requirements for glibc (see feature_test_macros(7)): kill(): _POSIX_C_SOURCE >= 1 || _XOPEN_SOURCE || _POSIX_SOURCE DESCRIPTION
The kill() system call can be used to send any signal to any process group or process. If pid is positive, then signal sig is sent to the process with the ID specified by pid. If pid equals 0, then sig is sent to every process in the process group of the calling process. If pid equals -1, then sig is sent to every process for which the calling process has permission to send signals, except for process 1 (init), but see below. If pid is less than -1, then sig is sent to every process in the process group whose ID is -pid. If sig is 0, then no signal is sent, but error checking is still performed; this can be used to check for the existence of a process ID or process group ID. For a process to have permission to send a signal it must either be privileged (under Linux: have the CAP_KILL capability), or the real or effective user ID of the sending process must equal the real or saved set-user-ID of the target process. In the case of SIGCONT it suf- fices when the sending and receiving processes belong to the same session. RETURN VALUE
On success (at least one signal was sent), zero is returned. On error, -1 is returned, and errno is set appropriately. ERRORS
EINVAL An invalid signal was specified. EPERM The process does not have permission to send the signal to any of the target processes. ESRCH The pid or process group does not exist. Note that an existing process might be a zombie, a process which already committed termi- nation, but has not yet been wait(2)ed for. CONFORMING TO
SVr4, 4.3BSD, POSIX.1-2001. NOTES
The only signals that can be sent to process ID 1, the init process, are those for which init has explicitly installed signal handlers. This is done to assure the system is not brought down accidentally. POSIX.1-2001 requires that kill(-1,sig) send sig to all processes that the calling process may send signals to, except possibly for some implementation-defined system processes. Linux allows a process to signal itself, but on Linux the call kill(-1,sig) does not signal the calling process. POSIX.1-2001 requires that if a process sends a signal to itself, and the sending thread does not have the signal blocked, and no other thread has it unblocked or is waiting for it in sigwait(3), at least one unblocked signal must be delivered to the sending thread before the kill() returns. Linux Notes Across different kernel versions, Linux has enforced different rules for the permissions required for an unprivileged process to send a signal to another process. In kernels 1.0 to 1.2.2, a signal could be sent if the effective user ID of the sender matched that of the receiver, or the real user ID of the sender matched that of the receiver. From kernel 1.2.3 until 1.3.77, a signal could be sent if the effective user ID of the sender matched either the real or effective user ID of the receiver. The current rules, which conform to POSIX.1-2001, were adopted in kernel 1.3.78. BUGS
In 2.6 kernels up to and including 2.6.7, there was a bug that meant that when sending signals to a process group, kill() failed with the error EPERM if the caller did have permission to send the signal to any (rather than all) of the members of the process group. Notwith- standing this error return, the signal was still delivered to all of the processes for which the caller had permission to signal. SEE ALSO
_exit(2), killpg(2), signal(2), tkill(2), exit(3), sigqueue(3), capabilities(7), credentials(7), signal(7) COLOPHON
This page is part of release 3.44 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/. Linux 2009-09-15 KILL(2)
All times are GMT -4. The time now is 08:14 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy