Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Which Debian or Ubuntu package has the /sbin/shutdown command in it? I want to read the source of that command (and possibly modify it to report notification on desktop) and I didn't know which package source to download.

share|improve this question
add comment

3 Answers

up vote 8 down vote accepted

Which installed package provides /sbin/shutdown on my system?

$ dpkg -S /sbin/shutdown
sysvinit: /sbin/shutdown

Which package in the distribution provides /sbin/shutdown? Install the apt-file package and run apt-file update if necessary, then

$ apt-file search /sbin/shutdown
molly-guard: /usr/sbin/shutdown
sysvinit: /sbin/shutdown
upstart: /sbin/shutdown

To download the source (if you're using the default init system SysVinit):

apt-get source sysvinit

This is probably not the place to configure desktop notifications though. Configuring the boot and shutdown process is typically done through scripts in /etc/init.d. Link a script in /etc/rc0.d to have it executed on shutdown and in /etc/rc6.d to have it executed before rebooting; see the policy manual for more information. Desktop notifications go through dbus.

share|improve this answer
    
+1 for the note on dbus –  Johan Aug 2 '11 at 8:09
    
Thanks for detailed explanation. What I meant was to report "System going down in NN minutes" messages that shutdown emits to user terminals via wall command. My initial idea was to make libnotify read wall messages by anyone and display them in desktop. But developers in Debian (Fedora too) felt that best way is for shutdown to call libnotify as they felt writing/reading utmp was archaic. –  Akilan Aug 2 '11 at 14:27
add comment

dpkg -S gives us this on a Ubuntu 10.04

dpkg -S /sbin/shutdown 
upstart: /sbin/shutdown

But on a Debian 5 box I get this

dpkg -S /sbin/shutdown 
sysvinit: /sbin/shutdown
share|improve this answer
add comment

For the sake of completeness, this is on a yum based system

yum whatprovides /sbin/shutdown

share|improve this answer
    
..or rpm -qf $(which shutdown) to find what package you have installed that is providing that command. –  Caleb Aug 3 '11 at 9:25
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.