Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

shutdown(2) [opendarwin man page]

SHUTDOWN(2)						      BSD System Calls Manual						       SHUTDOWN(2)

shutdown -- shut down part of a full-duplex connection SYNOPSIS
#include <sys/socket.h> int shutdown(int s, int how); DESCRIPTION
The shutdown() call causes all or part of a full-duplex connection on the socket associated with s to be shut down. If how is 0, further receives will be disallowed. If how is 1, further sends will be disallowed. If how is 2, further sends and receives will be disallowed. DIAGNOSTICS
A 0 is returned if the call succeeds, -1 if it fails. ERRORS
The call succeeds unless: [EBADF] S is not a valid descriptor. [ENOTSOCK] S is a file, not a socket. [ENOTCONN] The specified socket is not connected. SEE ALSO
connect(2), socket(2) HISTORY
The shutdown() function call appeared in 4.2BSD. 4.2 Berkeley Distribution June 4, 1993 4.2 Berkeley Distribution

Check Out this Related Man Page

SHUTDOWN(2)						     Linux Programmer's Manual						       SHUTDOWN(2)

shutdown - shut down part of a full-duplex connection SYNOPSIS
#include <sys/socket.h> int shutdown(int sockfd, int how); DESCRIPTION
The shutdown() call causes all or part of a full-duplex connection on the socket associated with sockfd to be shut down. If how is SHUT_RD, further receptions will be disallowed. If how is SHUT_WR, further transmissions will be disallowed. If how is SHUT_RDWR, further receptions and transmissions will be disallowed. RETURN VALUE
On success, zero is returned. On error, -1 is returned, and errno is set appropriately. ERRORS
EBADF sockfd is not a valid descriptor. ENOTCONN The specified socket is not connected. ENOTSOCK sockfd is a file, not a socket. CONFORMING TO
POSIX.1-2001, 4.4BSD (the shutdown() function call first appeared in 4.2BSD). NOTES
The constants SHUT_RD, SHUT_WR, SHUT_RDWR have the value 0, 1, 2, respectively, and are defined in <sys/socket.h> since glibc-2.1.91. SEE ALSO
connect(2), socket(2), socket(7) COLOPHON
This page is part of release 3.27 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at Linux 2008-12-03 SHUTDOWN(2)
Man Page

15 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

UID problem

I'm teaching myself UNIX, so bear with me! :) I created two user accounts on my box. One day I shut down the system using "shutdown -h 1". The system shut down cleanly. A few days I rebooted the box, no problem. But root is the only account that can log in. The other 2 user accounts... (10 Replies)
Discussion started by: ChrisFoxx
10 Replies

2. UNIX for Advanced & Expert Users

Shutdown script

Hi Guys, I want to execute few of my bash script, so that whenever someone calls shutdown now -r command, I want my script to execute first before shutting down. Any help please????? I've just started playing with the unix system, so far its been brilliant.... (10 Replies)
Discussion started by: alpha_manic
10 Replies

3. UNIX for Dummies Questions & Answers

A script for shutdown

I want to make a script to shutdown a unixware computer from other user then root. In Sco version i use "as root" but in the unixware i don't know. Please help me. 10x (12 Replies)
Discussion started by: kelu
12 Replies

4. UNIX for Advanced & Expert Users

Capturing Oracle Shutdown error

Hi, Iam calling 3 sql scripts through one shell script ''. 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

5. Shell Programming and Scripting

Help with script, shutdown if no ping responce

Hi, i would like to create a script that shuts down the system if the power fails, basicly the solaris box would load the script at startup. Ping every 20 secs If cannot get responce 3 times in a row send init 0 to the system. Simple but effective, as wont be on... (39 Replies)
Discussion started by: ringofsteel
39 Replies

6. UNIX for Advanced & Expert Users

emergency shutdown best practices.

Has anyone implemented or have suggestions on how to shutdown many remote unix/linux servers from a single script initiated from 1 server? I need this to execute in parallel as time is not on my side. Our ups is sadly underrated and will die in approximately 15 minutes. (There is not... (10 Replies)
Discussion started by: jsw371
10 Replies

7. AIX

aix shutdown automatically

hi, My AIX (5.3) machine is getting shutdown automatically. After restarting the machine, its screen goes black and it shows in green: Unmounting the file system.... bringing down the network interface en0 ln0.......halt completed and system shutdowns. Can... (8 Replies)
Discussion started by: Vanit
8 Replies

8. Emergency UNIX and Linux Support

Shutdown all systems remotely

Hi, I am a sysadmin. During long weekends i need to turn off all machines in my lab. Is it possible to shutdown systems using ip address without using ssh. i read somewhere that shutdown -m "IPADDR" may work. However it seems its a windows specific command. So my question is how do i... (11 Replies)
Discussion started by: vickylife
11 Replies

9. Solaris

Solaris 10 container graceful shutdown?

Hi, I've got a UPS connected to my Solaris 10 machine and I'm planning to run containers/zones on there. At the moment if the UPS agent sends the signal to the solaris machine to shutdown, all the apps shutdown gracefully and then the host goes down. If I setup containers for the apps, does... (9 Replies)
Discussion started by: fastexit
9 Replies

10. Emergency UNIX and Linux Support

Shutdown to a Halt and restart

I've got critical patching this weekend on 6 HP UX machines, back to back and the customer has requested to shutdown, and halt the machines and to bring it up at a later period. The thing is the servers are located offshore and we are just the support team. I have a special login thru a console... (16 Replies)
Discussion started by: hedkandi
16 Replies

11. Linux

Delay gnome shutdown/restart

Hi to all. My first message here, but i following you via twitter feed from many time... The question: I need to delay 5-10 seconds the shutdown command executed when the user click on the power off/reboot in their session or at login screen. I need that because i have in the background a... (18 Replies)
Discussion started by: mendez
18 Replies

12. Fedora

The user 'sync' and 'shutdown'

there are 'sync' and 'shutdown' users in my /etc/passwd. ... sync:x:5:0:sync:/sbin:/bin/sync shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown ... What does these mean? (10 Replies)
Discussion started by: vistastar
10 Replies

13. UNIX for Advanced & Expert Users

Problem relocating to another state with Shutdown

How are you, good afternoon, I do not speak and I do not write in English, and I'm iniciandome in unix / linux on my own, I am using the google translator, my question is this, know what are the shutdown command to change user State: # shutdown -y -g0 -i0 (completely off my system) # shutdown... (8 Replies)
Discussion started by: PrincipianteZ
8 Replies

14. Programming

Problem on capturing system Shutdown

I am having exactly the same problem with but the thread is old and closed. The only difference is that I use sigaction() instead of signal(), which is recommended, as far as I know. This is my code: ... (9 Replies)
Discussion started by: hakermania
9 Replies

15. Shell Programming and Scripting

Issue with shutdown command in script (MacOS High Sierra)

Hello, I have a backup script that runs an rsync backup to an external drive. I use the script frequently on Windows and Linux and have installed it on a Mac. The script has an option to run shutdown after the backup has completed. Since backup can take hours to run, this is an option that is... (10 Replies)
Discussion started by: LMHmedchem
10 Replies