Visit Our UNIX and Linux User Community

Linux and UNIX Man Pages

Test Your Knowledge in Computers #377
Difficulty: Medium
macOS is UNIX V7 compliant.
True or False?
Linux & Unix Commands - Search Man Pages

shutdown(2) [bsd man page]

SHUTDOWN(2)							System Calls Manual						       SHUTDOWN(2)

shutdown - shut down part of a full-duplex connection SYNOPSIS
shutdown(s, how) int s, 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, then fur- ther receives will be disallowed. If how is 1, then further sends will be disallowed. If how is 2, then 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) 4.2 Berkeley Distribution May 15, 1985 SHUTDOWN(2)

Check Out this Related Man Page

shutdown(3SOCKET)					     Sockets Library Functions						 shutdown(3SOCKET)

shutdown - shut down part of a full-duplex connection SYNOPSIS
cc [ flag... ] file... -lsocket -lnsl [ library... ] #include <sys/socket.h> int shutdown(int s, int how); DESCRIPTION
The shutdown() call shuts down all or part of a full-duplex connection on the socket associated with s. If how is SHUT_RD, further receives are disallowed. If how is SHUT_WR, further sends are disallowed. If how is SHUT_RDWR, further sends and receives are disallowed. The how values should be defined constants. RETURN VALUES
0 is returned if the call succeeds. -1 is returned if the call fails. ERRORS
The call succeeds unless one of the following conditions exists: EBADF The s value is not a valid file descriptor. ENOMEM Insufficient user memory is available for the operation to complete. ENOSR Insufficient STREAMS resources are available for the operation to complete. ENOTCONN The specified socket is not connected. ENOTSOCK The s value is not a socket. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |MT-Level |Safe | +-----------------------------+-----------------------------+ SEE ALSO
connect(3SOCKET), socket(3SOCKET), socket.h(3HEAD), attributes(5) SunOS 5.11 31 Jan 2005 shutdown(3SOCKET)

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

Featured Tech Videos