I've got a cli application written in nodejs using vorpal , live in a freebsd (v9.3), I need to know is there any way to prevent the user from exiting this app or not! I want it like when the application has started , it will never exit until reboot or shutting down the system. this is very critical and I mean it no way to exit the application at any cost . Is it possible at all ?
Edit: This is what i want: when my program start ,user can not exit the program except my own exit command, So i want to somehow prevent CTRL-Z,CTRL-C Or any other things like them. I can handle the SIGINT and errors but my problem is with "CTRL-Z" which fires a SIGSTOP signal and node cant listen to it . how can I disable this CTRL-z and others at all ? or is there any other solution maybe in my code or even modifying the bsd?
I found my answer in freebsd forums , here i want to share with you for those with same purpose.
As mentioned in that forum, I needed to wrap my program inside a C program which can detect and ignore signals . So this is the way:
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <unistd.h>
int
main(int argc, char *argv[])
{
/* Ignore signals from keyboard */
signal(SIGINT, SIG_IGN);
signal(SIGTSTP, SIG_IGN);
signal(SIGQUIT, SIG_IGN);
system("node path/to/your/program");
/* Whatever needs to be done if this point is reached. */
return (0);
}
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments