LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices


Reply
  Search this Thread
Old 11-20-2011, 11:10 AM   #1
SSDnoob
LQ Newbie
 
Registered: Nov 2011
Posts: 12

Rep: Reputation: Disabled
Run scripts at openbox poweroff and reboot


my setup;Fedora 16 gnome installation, open box installed upon gnome works stand alone and gets fired up from GDM

#bash_logout
First tried the bash_logout as any sane linux user would, turns out gdm2 work without a login shell so bash_logout/login is worthless.

#rc0.d
Second I went ahed and done chkconfig -add myscript and `chkconfig myscript on -level 06`. But my script didn't got executed.

#gdm postsession
Lastly I went into /etc/gdm/PostSession/Default and added /home/asd/myscript.sh into it. Still nothing! I change my script with a test (`mkdir /home/asd/executed`) still nothing. I than realized gdm config was empty and added `PostSessionScriptDir=/etc/gdm/PostSession/` ;


Code:
[root@localhost mbp]# cat /etc/gdm/custom.conf
# GDM configuration storage

[daemon]
PostSessionScriptDir=/etc/gdm/PostSession/
[security]

[xdmcp]

[greeter]

[chooser]

[debug]
Still nothing! Please help, I'm pretty lost
 
Old 11-21-2011, 08:53 PM   #2
sag47
Senior Member
 
Registered: Sep 2009
Location: Raleigh, NC
Distribution: Ubuntu, PopOS, Raspbian
Posts: 1,899
Blog Entries: 36

Rep: Reputation: 477Reputation: 477Reputation: 477Reputation: 477Reputation: 477
Openbox has nothing to do with Gnome so gdm wouldn't do anything.

You need to put the script /etc/rc.d/init.d/. It needs to be a proper service script which can be run with...

Code:
service xyz start
service xyz stop
You should soft symlink your /etc/rc.d/init.d/ script (ln -s) into /etc/rc.d/rc0.d/ for the system halt and /etc/rc.d/rc6.d/ for the system restart. Numbering it will give it a priority compared to the other S* and K* scripts. If the symlink starts with an 'S' then it will start the service (or execute a function) by way of "service xyz start". If the symlink starts with a 'K' then the service will be issued a stop command (i.e. "service xyz stop").

The question is, why? Why do you want to run a script at shutdown or reboot?

And before blindly implementing my suggestion which simply gives you an overview of the process you should really do research into the Linux init process and how it pertains to your system. chkconfig does something similar.

SAM

Last edited by sag47; 11-21-2011 at 08:56 PM.
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
halt, reboot, poweroff, everybody! Jerry Mcguire Linux - General 5 10-18-2010 09:15 AM
reboot/poweroff how? demmylls Linux - General 2 08-13-2009 09:52 AM
Scripts under rc0.d and rc6.d do not seem to run during shutdown.reboot oferu Linux - Newbie 4 03-26-2008 10:34 AM
Panic; reboot/poweroff; 2.4.33.3 Tralce Linux - Kernel 0 12-04-2006 02:54 PM
reboot vs poweroff??? bigdog0007 Linux - Newbie 4 09-16-2005 02:48 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop

All times are GMT -5. The time now is 03:12 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration