Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

In this answer on SO, I gave an example that should have used a -SIGCONT signal in a job submitted to at. However, I found that the process that I had stopped with -SIGSTOP did not continue. When I changed the signal to the numeric value, it worked.

echo "kill -18 $rspid"|at now + 2 minutes

It's a bad idea to use the numeric value because it can be different on different systems.

How can I submit this job with a symbolic signal (-SIGCONT) instead of the numeric one (-18)?

share|improve this question
add comment

2 Answers

My guess would be that whatever shell your at job is using is different to the one that you use at the command line, and the at job shell doesn't have a kill built-in that knows about symbolic signal symbols. This is common on Ubuntu, which uses dash for /bin/sh (which is used by at by default) but /bin/bash for interactive shells.

You can use the 'kill' binary by specifying the path to it:

echo "/bin/kill -CONT $rspid" | at now + 2 minutes

Or else specify the shell to execute explicitly:

echo "/bin/bash -c \"kill -CONT $rspid\"" |at now + 2 minutes

I thought there was an option to tell at what shell to use, but I can't seem to find any mention of it now. Perhaps a shebang would work...

share|improve this answer
add comment
up vote 1 down vote accepted

It turns out that dash likes signals in the form -CONT and doesn't understand the -SIGCONT style. Since bash understands both, it may be more portable to use the former.

In my testing, it didn't make any difference whether I included an explicit path to 'kill' but the way the signal is specified did.

share|improve this answer
2  
Indeed -NAME (e.g. -CONT) or -s NAME (e.g. -s CONT) is the standard (opengroup.org/onlinepubs/000095399/utilities/kill.html) –  Matthew Flaschen May 9 '09 at 21:13
1  
Since that page is a bit lengthy and the information is near the bottom, I have quoted the relevant portion here: "An early proposal also required symbolic signal_names to be recognized with or without the SIG prefix. Historical versions of kill have not written the SIG prefix for the -l option and have not recognized the SIG prefix on signal_names. Since neither applications portability nor ease-of-use would be improved by requiring this extension, it is no longer required." –  Dennis Williamson May 10 '09 at 2:11
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.