PDA

View Full Version : [ubuntu] how to have a program run at shutdown



rburkartjo
January 31st, 2010, 03:12 PM
what do i have to do to have the app bleachbit(a file cleaner run at shutdown or reboot) have no idea if this can be done or how to do it/tks

yknivag
January 31st, 2010, 06:09 PM
You can use the @reboot syntax in cron to which will run the script everytime the machine starts up, I'm not sure if there is an @shutdown syntax also, there may be.

rburkartjo
February 13th, 2010, 11:45 AM
tks yk did it this way
You can put in a call to the program for every user at logout. Edit (using sudo) the file

/etc/gdm/PostSession/Default

Probably it looks like this right now:

#!/bin/sh

exit 0

In between those lines, add this line:

/usr/bin/bleachbit

I never used bleachbit, but I installed it to make sure I have the right path.

The script should look like this when finished:

#!/bin/sh
/usr/bin/bleachbit
exit 0

The only downside is it may take logouts and shutdowns a little longer. The upside is it will work without you having to remember to run it.
from sinister midget