SEARCH

Enter your search query in the box above ^, or use the forum search tool.

You are not logged in.

#1 2014-08-11 20:54:23

BruceJohnJennerLawso
#! Member
Registered: 2014-02-23
Posts: 50

Trying to create a shutdown script

So I am trying to create a script that runs whenever crunchbang is shutdown (via either the super-x gui interface, or just typing sudo poweroff into the terminal)

I followed the instructions here:

http://ubuntuforums.org/showthread.php?t=185261

added the script to /etc/init.d, created the symlink to the script in rc0.d and rc6.d, but nothing happens (specifically, its supposed to write uptime to a text file)

I tried renaming the link to K01shutdown.sh in case the command couldnt be executed later on in the shutdown process or something, but still nothing happens.

Any thoughts would be greatly appreciated wink

Last edited by BruceJohnJennerLawso (2014-08-11 20:55:05)


The computer is mightier than the pen, the sword, and usually the programmer.

My Projects on Github

Offline

Be excellent to each other!

#2 2014-08-11 21:08:37

damo
#! gimpbanger
From: N51.5 W002.8 (mostly)
Registered: 2011-11-24
Posts: 4,442

Re: Trying to create a shutdown script

You can probably modify the way I do it for a shutdown sound, by adding a command to /usr/bin/cb-exit.

      def shutdown_action(self,btn):
                self.disable_buttons()
                self.status.set_label("Shutting down, please standby...")

Add ->          os.system("command-or-script-you-want--to-run")

                os.system("dbus-send --system --print-reply --dest=\"org.freedesktop.ConsoleKit\" /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Stop")

Last edited by damo (2014-08-11 21:09:47)


Artwork at deviantArt;  Iceweasel Personas;  SLiM #! Themes;  Openbox themes

Online

#3 2014-08-12 16:48:19

BruceJohnJennerLawso
#! Member
Registered: 2014-02-23
Posts: 50

Re: Trying to create a shutdown script

damo wrote:

You can probably modify the way I do it for a shutdown sound, by adding a command to /usr/bin/cb-exit.

      def shutdown_action(self,btn):
                self.disable_buttons()
                self.status.set_label("Shutting down, please standby...")

Add ->          os.system("command-or-script-you-want--to-run")

                os.system("dbus-send --system --print-reply --dest=\"org.freedesktop.ConsoleKit\" /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Stop")

Thanks Damo, that worked (although I discovered that naming a script shutdown was bad, since there seems to be another program with that name)

I still dont understand why the previous method did not work though


The computer is mightier than the pen, the sword, and usually the programmer.

My Projects on Github

Offline

#4 2014-08-12 18:02:09

Alad
Software Satan
Registered: 2014-02-20
Posts: 1,511

Re: Trying to create a shutdown script

Offline

#5 2014-08-12 18:02:30

damo
#! gimpbanger
From: N51.5 W002.8 (mostly)
Registered: 2011-11-24
Posts: 4,442

Re: Trying to create a shutdown script

BruceJohnJennerLawso wrote:

Thanks Damo, that worked (although I discovered that naming a script shutdown was bad, since there seems to be another program with that name)

big_smile

Always handy to check a script name with:

$ which shutdown
/sbin/shutdown

Artwork at deviantArt;  Iceweasel Personas;  SLiM #! Themes;  Openbox themes

Online

Board footer

Powered by FluxBB

Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.

Debian Logo