LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 02-23-2019, 09:23 AM   #1
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: FreeBSD/Slackware-14.2+/ArcoLinux
Posts: 9,135

Rep: Reputation: 1927Reputation: 1927Reputation: 1927Reputation: 1927Reputation: 1927Reputation: 1927Reputation: 1927Reputation: 1927Reputation: 1927Reputation: 1927Reputation: 1927
Openbox terminate process upon logout of openbox How to?


is there a means to run a script to kill processes that where started with the autostart script upon login to openbox, like WindowMaker has, or what mechanisms are there that I can cut into and execute a script to kill some of the things I started when logging into openbox?

I could go into the xml file and edit it,
Code:
        <menu id="40" label="OpenBox">
            <menu id="client-list-menu"/>
            <item label="Reconfigure"> <action name="Reconfigure"/> </item>
            <separator/>
            <item label="Exit"> <action name="Exit"/> </item>
add a redirect to a script that kills the processes, then call exit perhaps. Though, every time I would update the menu it would be over written, so I'd have to go back in an edit it, or write another script calling menumaker, then using sed perhaps to remove and add that part back into the menu after menumaker is done re-creating the menu. Is there a way to get around that or is that pretty much the only avenue of attack?

this is mainly at the time of this writing, to kill a script that is running to simply change the background at a given time.

Last edited by BW-userx; 02-23-2019 at 09:27 AM.
 
Old 02-23-2019, 10:45 AM   #2
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: FreeBSD/Slackware-14.2+/ArcoLinux
Posts: 9,135

Original Poster
Rep: Reputation: 1927Reputation: 1927Reputation: 1927Reputation: 1927Reputation: 1927Reputation: 1927Reputation: 1927Reputation: 1927Reputation: 1927Reputation: 1927Reputation: 1927
wrapper for menumaker : openbox
Code:
#!/bin/bash
mmaker -t xterm -f openbox3 

sed -i 's+<execute>gparted</execute>+<execute>gksu gparted</execute>+g' ~/.config/openbox/menu.xml 
sed -i 's+<item label="Exit"> <action name="Exit"/> </item>+<item label="Exit">  <action name="Execute"> \
		<execute>~/bin/obshutdown</execute> \
	</action> </item>+g' ~/.config/openbox/menu.xml
obshutdown, taken off wmakers then made to work for openbox...
Code:
#!/bin/sh
#
# Place commands to be executed when openbox is exited here.
#
# Openbox will wait until this script finishes, so if you run any
# commands that take long to execute (like a xterm), put a ``&'' in the
# end of the command line.
#
# This file must be executable.
#

piddy=$(pgrep -u $USER changebg)
kill "$piddy"

pkill openbox
it may have been a redundant question but just wanted to know...
 
Old 02-23-2019, 01:43 PM   #3
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 12,471
Blog Entries: 9

Rep: Reputation: 3375Reputation: 3375Reputation: 3375Reputation: 3375Reputation: 3375Reputation: 3375Reputation: 3375Reputation: 3375Reputation: 3375Reputation: 3375Reputation: 3375
isn't menumaker configurable to include custom menu entries?
at least obmenu-generator is.

anyhow, do you want to kill ALL user processes after killing openbox?
how did you login and start X?
if you used "exec startx", you will be logged out when you kill openbox.
then it depends a little on the init system, but it's possible to automatically kill all user processes on logout.
 
Old 02-23-2019, 02:19 PM   #4
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: FreeBSD/Slackware-14.2+/ArcoLinux
Posts: 9,135

Original Poster
Rep: Reputation: 1927Reputation: 1927Reputation: 1927Reputation: 1927Reputation: 1927Reputation: 1927Reputation: 1927Reputation: 1927Reputation: 1927Reputation: 1927Reputation: 1927
Quote:
Originally Posted by ondoho View Post
isn't menumaker configurable to include custom menu entries?
at least obmenu-generator is.

anyhow, do you want to kill ALL user processes after killing openbox?
how did you login and start X?
if you used "exec startx", you will be logged out when you kill openbox.
then it depends a little on the init system, but it's possible to automatically kill all user processes on logout.
right now I am using kde login manager. menumaker has a py file that can be edited, but mostly all I've ever done with that is correct the path when using wmaker for a WM.

I'm not user if I want to kill every process, never tired that to see what it does. I started using a script to change backgrounds and noticed that when I logged out of Wmaker and into openbox to set that up, the script was still running. So I fixed that in Wmaker because it has a shutdown script just for that reason. whereas Openbox is less setup for that kind of a thing.

killing every 'user' process should not be a bad thing seeings how this is on logout anyways?
 
  


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
bash - how to terminate a process after certain time alan43 Linux - Newbie 1 03-12-2009 02:35 PM
[Bash] Waiting for a process to terminate or stopping it after some time hamtavs Linux - General 2 12-12-2008 05:25 PM
how ctrl+c works to terminate a process rithik_ghoshal Linux - General 2 11-02-2008 08:01 AM
how to terminate dispatch.fcgi process properly sathiyamoorthy Debian 0 02-26-2008 11:20 PM
ctrl-c to terminate a process does not work geek1234 Linux - Newbie 1 12-26-2007 02:34 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:52 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