Sponsored Content
Top Forums Programming Problem on capturing system Shutdown Post 302847687 by hakermania on Tuesday 27th of August 2013 02:55:05 PM
Old 08-27-2013
I just downloaded the source code of ettercap-graphical (a well know application) and it doesn't use async-safe functions in the code (fprintf is being used, user interface is being normally shut down, the log file is flushed and closed). So how "strict" is it to make async-safe functions?

I also have this simple question: Why not use async-unsafe functions after all? The worse thing that could happen would be the application to crash or to be in a loop easily terminated with SIGKILL. The application was going to forcefully terminate after all. At least give it a chance to do a proper cleanup.

As for simulating shutdown: Now I am simulating shutdown with simply sending SIGTERM to my process. As I said before, this is not the only thing that really happens, because when I send SIGTERM it runs the handler without any problem. So, the system does something else that I am unaware of (I highly doubt that it really spends time on checking whether the function that is to be called is async-safe or not). So, I simply asked whether there is a better way to simulate the shutdown for only one process, because simply sending SIGTERM is not the best way. I don't believe I am being irrational.
 

8 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Capturing Oracle Shutdown error

Hi, Iam calling 3 sql scripts through one shell script 'rmia.sh'. Till now this was working fine, but last time while calling the SQL scripts, Oracle was down. But amazingly the exit status was '0' (success)!!! Below is the shell code: #!/usr/bin/ksh -x assign_file asql a.sql 1... (15 Replies)
Discussion started by: ganapati
15 Replies

2. Shell Programming and Scripting

Shutdown a system by MAC?

Ok here is the problem we have 2 v440 with same IP address running solars 9. one remains on the other remains off. They are both configured exactly the same for redundant purposes for the software we use. This was the best/worst idea. Great because down time is only a mere minutes. The bad is the... (7 Replies)
Discussion started by: deaconf19
7 Replies

3. Solaris

logs for system shutdown

I am working on a SUN T2000 machine with Solaris 10 running on it. When I checked the system this morning, I found it to be turned off. The lastreboot command showed that the system had been shut down the previous night. I want to find out how the system was shut down. I have run hardware health... (2 Replies)
Discussion started by: batman727
2 Replies

4. Shell Programming and Scripting

Sending mail on system shutdown

I want to only send a mail before my system goes for a shutdown or reboot. I don't want a mail when it comes up after a reboot or is normally started.. How can i achieve this? (2 Replies)
Discussion started by: proactiveaditya
2 Replies

5. Windows & DOS: Issues & Discussions

system restarts after shutdown!!

Hello, from last few days my laptop is not whutting down properly.. when ever i ty to shutdown it restarts again.. what may be problem?? antivirus is updated till date.. and i use windows xp sp2.... regards, deepak. (5 Replies)
Discussion started by: smarty86
5 Replies

6. Shell Programming and Scripting

Capturing awk's system(cmd) output

Hi everybody, I am working on a bigger awk script in which one part is comparing the size of two files. I want to evaluate which file is bigger and then just save the bigger one. I got it all working except for the part where I want to figure out which file is bigger; the one awk is currently... (2 Replies)
Discussion started by: iMeal
2 Replies

7. Solaris

Shutdown system option

I am working on sunos solaris. I want to know which is good for system shut-down ? (3 Replies)
Discussion started by: Jitesh Varshney
3 Replies

8. Red Hat

shutdown system/myeclipse

Hi All, I have one situation to shut-down the system through shell script.I need script command to shut-down the system and process should end(safe-mode) the MyEclipse. (0 Replies)
Discussion started by: stsivaraj
0 Replies
SHUTDOWN(8)						      System Manager's Manual						       SHUTDOWN(8)

NAME
shutdown - graciously close the system down SYNOPSIS
shutdown [-hrRmk] [-x code] [time-specification [message]] DESCRIPTION
Shutdown is a program which allows a system operator to close down the system in an nice way. Shutdown informs the users why and when the system is going down. This warning is issued 10 minutes before shutdown time and every minute in the last 5 minutes. At this time (5 min- utes), shutdown creates a file /etc/nologin to prevent new users from logging in. Shutdown keeps a logfile of shutdowns. Every shutdown is registered in /usr/adm/wtmp, if this file exists. After these actions, a call is done to reboot(2) which actually brings the system down. Time-specification may be something like 15:00, 15.00, +15, or now for a shutdown at 3pm (twice), 15 minutes from now, or immediately. The message may be used to describe why the system is going down, it may also be typed on standard input with the -m option. OPTIONS
-h This flag prevents the system from rebooting after the shutdown. The system can now be powered off. This is the default. -r This flag indicates that the system should reboot after shutting down. -R Reboot the system by resetting it. Normally the kernel will try to return to the Boot Monitor. With -R the system will receive a hardware reset. -x code Halt the system and let the Monitor execute the given code as if typed at the monitor prompt. You can for instance use -x 'boot hd0' as a very fast way to reboot "from the top." -m Allows the operator to type a shutdown message on standard input, that will be added to the messages displayed on all terminals. -k This option gives the possibility of terminating an already started shutdown. This is only possible if shutdown time has not yet arrived. -C Check if the system crashed. This option is not used at shutdown time, but at reboot time. It tells if the file systems should be checked by testing if the last entry in the wtmp file is a shutdown entry. (A crude replacement for a file system clean flag.) FILES
/usr/adm/wtmp, /etc/nologin, /usr/adm/authlog SEE ALSO
reboot(2), wall(1), halt(8), boot(8). AUTHOR
Edvard Tuinder (v892231@si.hhs.NL) SHUTDOWN(8)
All times are GMT -4. The time now is 12:39 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy