LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Arch
User Name
Password
Arch This Forum is for the discussion of Arch Linux.

Notices


Reply
  Search this Thread
Old 08-03-2018, 03:44 PM   #1
ewlabonte
Member
 
Registered: Mar 2005
Distribution: Debian Stretch
Posts: 127

Rep: Reputation: 15
How to stop script on exiting Xorg.


I run Pekwm as my primary window manager and I use a simple script that uses feh to change the wallpaper every 10 minutes. When I log out, the script keeps on running. If I log out and log in again several times there are several instances of the script running. I can, of course, kill them with a killall command, but is there a way to stop the script when I leave Xorg automatically. Pekwm has a "start" file where you can start apps and scripts at startup, but it doesn't have a "shutdown" file that you can run when you log out.
 
Old 08-03-2018, 05:08 PM   #2
ewlabonte
Member
 
Registered: Mar 2005
Distribution: Debian Stretch
Posts: 127

Original Poster
Rep: Reputation: 15
I found a solution. I run another script along with it that tests if Xorg is running. If not, it kills the other script. Maybe not the best solution, but it works.
 
Old 08-04-2018, 12:52 AM   #3
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
user processes started under gui should be terminated when the gui exits, unless specified otherwise.
how are you starting the feh command/script?
can you show us the pekwm autostart file and the feh script?
how do you start pekwm?
 
Old 08-04-2018, 08:59 AM   #4
ewlabonte
Member
 
Registered: Mar 2005
Distribution: Debian Stretch
Posts: 127

Original Poster
Rep: Reputation: 15
Here's ~/.pekwm/start

#!/bin/sh
killall feh-wall-changer.sh
synclient tapbutton1=1 &
xinput set-prop --type=int --format=8 11 289 0, 0, 0, 0, 1, 2, 3
syndaemon -i .5 &
xscreensaver -no-splash &
/home/ewl/bin/feh-wall-changer.sh &
setxkbmap us -variant altgr-intl -option compose:rctrl &
conky &
bbpager &

and here's ~/bin/feh-wall-changer.sh

#!/bin/sh
# Script to randomly set Background from files in a directory
while true;do

# Directory Containing Pictures
DIR="/home/ewl/Pictures/Wallpapers"

# Command to Select a random jpg file from directory
# Delete the *.jpg to select any file but it may return a folder
PIC=$(ls $DIR/* | shuf -n1)

# Command to set Background Image
feh --bg-center $PIC

# specify how long to wait in seconds between changes
sleep 600
done
 
Old 08-04-2018, 12:27 PM   #5
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
so do you really like that look that feh gives you on your background images? I wrote a program that gives the user a lot more control over the images and colors due to feh's, because of the lack of giving that same control when setting an image to the background when using feh. just one line startup, and it shuts down upon exit of xorg, gives the ability to set image size and colors, tiles, and randomizes everything if one wants to, and more. it's a lot nicer than feh and easier to run then all of what you had to write to get feh to do this. its all self contained within the program.

its in slackbuilds
https://slackbuilds.org/repository/1...?search=mh5000

Last edited by BW-userx; 08-04-2018 at 12:30 PM.
 
Old 08-04-2018, 12:42 PM   #6
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
that's strange.
i'm pretty sure under openbox this would get terminated when i exit openbox.
i will try some testing to verify (also using arch).
you could try to start the wallpaperchanger from a .desktop file in an XDG autostart directory instead, e.g. ~/.config/autostart/something.desktop

how do you start pekwm? display manager or startx and ~/.xinitrc?
if the latter, you could also try to put the wallpaper script in .xinitrc, maybe it will be treated differently.
 
Old 08-04-2018, 05:44 PM   #7
ewlabonte
Member
 
Registered: Mar 2005
Distribution: Debian Stretch
Posts: 127

Original Poster
Rep: Reputation: 15
I start it from slim display manager which uses .xinitrc
 
Old 08-04-2018, 09:00 PM   #8
ewlabonte
Member
 
Registered: Mar 2005
Distribution: Debian Stretch
Posts: 127

Original Poster
Rep: Reputation: 15
I still haven't figured it out. I resolved the situation by switching to a cron job. Makes more sense really.
 
Old 08-04-2018, 11:16 PM   #9
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Quote:
Originally Posted by ewlabonte View Post
I start it from slim display manager which uses .xinitrc
please see this: https://wiki.archlinux.org/index.php/Slim
i'm pretty sure the fact that slim is abandoned & does not fully support systemd, has something to do with your problem.
if you think you are using a valid version of slim (maybe somebody is working on it?), you can continue the troubleshooting as outlined previously.
 
  


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
no display after exiting out of xorg - slackware 13.37 marneson Slackware 2 11-05-2011 03:42 PM
Stop perl socket server broken pipe or exiting son_t Programming 1 10-25-2007 03:52 AM
SUSE 10.0 fix to stop error message when exiting X 1kyle SUSE / openSUSE 0 03-23-2006 05:17 AM
Help! slack 10 locks up when exiting xorg 6.7.0 wine Slackware 5 10-25-2004 10:15 PM
FreeBSD and Xorg Screen blanks after exiting Zero-0-Effect *BSD 0 10-01-2004 11:03 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Arch

All times are GMT -5. The time now is 08:42 AM.

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