LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-23-2015, 05:04 PM   #1
#linux
LQ Newbie
 
Registered: Sep 2015
Distribution: pclinuxos64, KDE desktop
Posts: 3

Rep: Reputation: Disabled
Need to run scripts after booting and before shutting in runlevel 5


hello,

I have some commands in .bash_login and .bash_logout and it works in runlevel 3 i.e console mode.

In runlevel 5 which is the GUI mode, .bash_login and .bash_logout is ignored. What equivalent files do I need to edit or create to do things after booting up and before shutting down in runlevel 5?

=-o
 
Old 09-23-2015, 08:31 PM   #2
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 16,817

Rep: Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408
what old operating system are you using ?
most current OS's use systemD and do not use "runlevel" anymore

they use "*.target "
 
Old 09-23-2015, 08:39 PM   #3
#linux
LQ Newbie
 
Registered: Sep 2015
Distribution: pclinuxos64, KDE desktop
Posts: 3

Original Poster
Rep: Reputation: Disabled
I'm using pclinuxos 64bit. It still uses init

I know how to run scripts at boot up now, but I'm not sure what files I need to edit or create to run when shutting down.

=-o

Last edited by #linux; 09-23-2015 at 08:41 PM.
 
Old 09-23-2015, 08:47 PM   #4
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,599

Rep: Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241
It depends on what the scripts actually do.

It is possible that it isn't boot/shutdown you need, but GUI login/logout, in which case it goes somewhere else - such as /etc/X11/xinit/Xsession

It can also depend on what GUI display manager you are using, as those put login/logout in different places, and may not use the Xsession file at all.

Last edited by jpollard; 09-23-2015 at 08:49 PM.
 
Old 09-23-2015, 09:08 PM   #5
#linux
LQ Newbie
 
Registered: Sep 2015
Distribution: pclinuxos64, KDE desktop
Posts: 3

Original Poster
Rep: Reputation: Disabled
I appreciate the hints of where to start, if that doesn't work, then I'll try the pclinuxos forum. Maybe they can tell me which files to edit or create to run scripts before shutting down the system.

=-o
 
Old 09-24-2015, 09:18 AM   #6
doni
LQ Newbie
 
Registered: Mar 2006
Posts: 26

Rep: Reputation: 1
Not sure what is your system architectire but if you are running SYSTEM V try putting the script in:
/etc/init.d/
Grant it executable permissions:
chmod 755 script.sh

and if you want to have it on runlevel 5:

chkconfig 5 90 10

First number is the runlevel, second is when it will start withiin runlevel 5 and last number is when it will stop
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
booting into runlevel 5, but I have it set for runlevel 3. Help. punt Fedora 13 06-01-2011 05:18 PM
Odd behavior switching to runlevel 3 or shutting down sntnlz Linux - Hardware 4 11-28-2005 11:19 PM
runlevel shell scripts sebastian.raghe Debian 4 04-15-2005 03:26 PM
Problem with init scripts when shutting down atlesn Linux - General 3 03-13-2004 06:10 AM
Shutting down the Xserver after booting in runlevel 5 zLinuxz Linux - General 5 10-26-2002 05:58 AM


All times are GMT -5. The time now is 10:39 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration