Is it possible to distinguish signal from kernel at reboot and at kill from terminal

Clash Royale CLAN TAG#URR8PPP
As I know, we can send a signal SIGTERM to a process by pressing ctrl+c or by using pkill -f processName.
Also, when we reboot or shutdown, the kernel will send SIGTERM to each process too.
So I'm asking if we could distinguish these two cases? (as they are all SIGTERM, we can't distinguish them by the signal)
Maybe the kernel provides us some kind of API? such as bool isRebooting() or bool isShutdown()?
process kill signals shutdown reboot
add a comment |
As I know, we can send a signal SIGTERM to a process by pressing ctrl+c or by using pkill -f processName.
Also, when we reboot or shutdown, the kernel will send SIGTERM to each process too.
So I'm asking if we could distinguish these two cases? (as they are all SIGTERM, we can't distinguish them by the signal)
Maybe the kernel provides us some kind of API? such as bool isRebooting() or bool isShutdown()?
process kill signals shutdown reboot
2
No, the kernel doesn’t sendSIGTERM, the shutdown procedure does. What init system and/or service manager are you using?
– Stephen Kitt
Dec 26 '18 at 12:39
"shutdown" is a userspace concept, not a kernel one. The init system (sysvinit, systemd, upstart,....) will be doing all this work.
– Stephen Harris
Dec 26 '18 at 13:17
what unix system sends a TERM signal when you mash control+c? more typical is an INT signal...
– thrig
Dec 26 '18 at 15:30
add a comment |
As I know, we can send a signal SIGTERM to a process by pressing ctrl+c or by using pkill -f processName.
Also, when we reboot or shutdown, the kernel will send SIGTERM to each process too.
So I'm asking if we could distinguish these two cases? (as they are all SIGTERM, we can't distinguish them by the signal)
Maybe the kernel provides us some kind of API? such as bool isRebooting() or bool isShutdown()?
process kill signals shutdown reboot
As I know, we can send a signal SIGTERM to a process by pressing ctrl+c or by using pkill -f processName.
Also, when we reboot or shutdown, the kernel will send SIGTERM to each process too.
So I'm asking if we could distinguish these two cases? (as they are all SIGTERM, we can't distinguish them by the signal)
Maybe the kernel provides us some kind of API? such as bool isRebooting() or bool isShutdown()?
process kill signals shutdown reboot
process kill signals shutdown reboot
edited Dec 26 '18 at 8:48
Yves
asked Dec 26 '18 at 8:38
YvesYves
860618
860618
2
No, the kernel doesn’t sendSIGTERM, the shutdown procedure does. What init system and/or service manager are you using?
– Stephen Kitt
Dec 26 '18 at 12:39
"shutdown" is a userspace concept, not a kernel one. The init system (sysvinit, systemd, upstart,....) will be doing all this work.
– Stephen Harris
Dec 26 '18 at 13:17
what unix system sends a TERM signal when you mash control+c? more typical is an INT signal...
– thrig
Dec 26 '18 at 15:30
add a comment |
2
No, the kernel doesn’t sendSIGTERM, the shutdown procedure does. What init system and/or service manager are you using?
– Stephen Kitt
Dec 26 '18 at 12:39
"shutdown" is a userspace concept, not a kernel one. The init system (sysvinit, systemd, upstart,....) will be doing all this work.
– Stephen Harris
Dec 26 '18 at 13:17
what unix system sends a TERM signal when you mash control+c? more typical is an INT signal...
– thrig
Dec 26 '18 at 15:30
2
2
No, the kernel doesn’t send
SIGTERM, the shutdown procedure does. What init system and/or service manager are you using?– Stephen Kitt
Dec 26 '18 at 12:39
No, the kernel doesn’t send
SIGTERM, the shutdown procedure does. What init system and/or service manager are you using?– Stephen Kitt
Dec 26 '18 at 12:39
"shutdown" is a userspace concept, not a kernel one. The init system (sysvinit, systemd, upstart,....) will be doing all this work.
– Stephen Harris
Dec 26 '18 at 13:17
"shutdown" is a userspace concept, not a kernel one. The init system (sysvinit, systemd, upstart,....) will be doing all this work.
– Stephen Harris
Dec 26 '18 at 13:17
what unix system sends a TERM signal when you mash control+c? more typical is an INT signal...
– thrig
Dec 26 '18 at 15:30
what unix system sends a TERM signal when you mash control+c? more typical is an INT signal...
– thrig
Dec 26 '18 at 15:30
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f490955%2fis-it-possible-to-distinguish-signal-from-kernel-at-reboot-and-at-kill-from-term%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f490955%2fis-it-possible-to-distinguish-signal-from-kernel-at-reboot-and-at-kill-from-term%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
2
No, the kernel doesn’t send
SIGTERM, the shutdown procedure does. What init system and/or service manager are you using?– Stephen Kitt
Dec 26 '18 at 12:39
"shutdown" is a userspace concept, not a kernel one. The init system (sysvinit, systemd, upstart,....) will be doing all this work.
– Stephen Harris
Dec 26 '18 at 13:17
what unix system sends a TERM signal when you mash control+c? more typical is an INT signal...
– thrig
Dec 26 '18 at 15:30