You are not logged in.
Hi
I launch some SH from .xinitrc, but they appear multiple times and I cannot figure out why.
This is how I do, from .xinitrc - running xmonad:
# start dzen2 scripts
./dev/dzen2/scripts/rtop.sh &
./dev/dzen2/scripts/rbottom.sh &
./dev/dzen2/scripts/lbottom.sh &
When I look in the process list (ps aux | grep sh) I get this result:
michael 7184 0.0 0.0 0 0 tty1 Z 11:19 0:00 [sh] <defunct>
michael 7186 0.0 0.0 6060 1360 tty1 S 11:19 0:00 /bin/bash ./dev/dzen2/scripts/rtop.sh
michael 7187 0.0 0.0 6060 1324 tty1 S 11:19 0:00 /bin/bash ./dev/dzen2/scripts/rbottom.sh
michael 7188 0.0 0.0 6060 1320 tty1 S 11:19 0:00 /bin/bash ./dev/dzen2/scripts/lbottom.sh
michael 7190 0.0 0.0 6064 788 tty1 S 11:19 0:00 /bin/bash ./dev/dzen2/scripts/rbottom.sh
michael 7199 0.2 0.0 6320 1104 tty1 S 11:19 0:34 /bin/bash ./dev/dzen2/scripts/rtop.sh
michael 7480 0.0 0.0 6064 840 tty1 S 11:19 0:00 /bin/bash ./dev/dzen2/scripts/lbottom.shExample script:
source "/home/michael/dev/dzen2/scripts/settings.sh"
while :
do
echo -e " ^fg($MYCOLORBLUE)^i($ICONPATH/shroom.xbm)^fg($MYCOLORWHITE) $(uname -r | tr '[A-Z]' ['a-z'])"
sleep 300
done | /usr/bin/dzen2 -ta l -h 20 -w 900 -y 800 -fg '#c4c4c4' -fn "$FONT"Any ideas as to why they're launched twice?
Thanks!
Last edited by valvet (2010-11-08 14:50:47)
Offline
Hey, thanks for responding.
I run X automatically, when logging in at tty1, like so:
# startx when logging into tty1
if [[ -z "$DISPLAY" ]] && [[ $(tty) = /dev/tty1 ]]; then
. startx
logout
fiMy .xinit looks like this:
michael@princess ~> cat .xinitrc
# start terminal emulation daemon
urxvtd -q -o -f &
# [url]http://wiki.archlinux.org/index.php/Per_Application_Transparency[/url]
#xcompmgr &
#devilspie -a &
# set keyboard language, and enable restart X
setxkbmap dk -option terminate:ctrl_alt_bksp &
# set the cursor
xsetroot -cursor_name left_ptr
# set wallpaper
sh /home/michael/.fehbg &
# hide mouse when not needed
unclutter -idle 1 &
# start dzen2 scripts
./dev/dzen2/scripts/rtop.sh &
./dev/dzen2/scripts/rbottom.sh &
./dev/dzen2/scripts/lbottom.sh &
# start xmonad
exec ck-launch-session dbus-launch --exit-with-session xmonadI don't know when .xinit is sourced, but I imagine it happens when X is started, using startx? I've not sourced it manually anywhere.
- m
Offline
Weird. Can't see any issues with that. Perhaps you could add a line to your .xinitrc such as:
echo "XXX" >> /home/michael/dummyand see if it is in fact being sourced twice.
Perhaps the duplicates are from a previous login? Do they get killed when you logout? Do they still appear after a reboot and login?
Offline
Weird. Can't see any issues with that. Perhaps you could add a line to your .xinitrc such as:
echo "XXX" >> /home/michael/dummyand see if it is in fact being sourced twice.
Perhaps the duplicates are from a previous login? Do they get killed when you logout? Do they still appear after a reboot and login?
That's a good test, I'll try that :-)
Offline
I did what you said, and echo'ed some stuff in .xinitrc - it only gets echoed once :-(.. this is weird. Can it have something to do with the loops inside my scripts? See example script I posted earlier.
Once I logout (using ctrl+alt+del), no bash processes exists, so the scripts are closed - they get doubled once I login to X.
Thanks for helping :-)
- m
Offline
What does your /home/michael/dev/dzen2/scripts/settings.sh look like?
Knute
Offline
Hi Knute
Well, it looks like this:
#!/bin/bash
# vim:ft=bash ts=4
#
FONT='xft:Droid Sans Mono:style=Regular:pixelsize=11:antialias=true:hinting=true:hintstyle=hintfull'
ICONPATH='/usr/share/icons/sm4tik'
MYCOLORBLACK='#000000'
MYCOLORWHITE='#ffffff'
MYCOLORBLUE='#d5767e'
MYCOLORGRAY='#484848'
MYCOLORGRAYDARK='#b8bcb8'
MYCOLORGRAYALT='#c4c4c4'
MYCOLORRED='#ff6565'But this also happened when I diden't have a settings file :x
Offline
maybe you can get some hints by looking at the parent ids of your scripts, to see what process started them
It looks like this:
As I can make out, it seems that lbottom.sh is launching another lbottom.sh? Before dzen.
Thanks :-)
- m
Offline
Hmmm. It is the script itself. I get the same outcome, two instances of the script, with:
#!/bin/bash
while :
do
echo "XXX"
sleep 300
done | dzen2 I'm guessing it is something to do with subshells though I'm not exactly sure what. ![]()
Offline
Hmmm. It is the script itself. I get the same outcome, two instances of the script, with:
#!/bin/bash while : do echo "XXX" sleep 300 done | dzen2I'm guessing it is something to do with subshells though I'm not exactly sure what.
Interesting :-).. it doesn't really bother me, but I just assume it's using double the resources. My rtop script for example is sleeping every 1 sec (has time/date printing out), if two of those are running at the same time, that's not ideal :x.
Well, hopefully someone can figure out why, based on your findings above :-)
Thanks!
- m
Offline
Hi again.
I should mention that this also happens when the scripts are zsh instead of sh. Odd!
Offline
hey,
i just did some reading and figured out, that both sites of a pipe are executed in their own subshell. So the second process with the same name is basically just the subshell executing the while-loop. So nothing to worry ;-)
Last edited by knopwob (2010-08-13 09:54:27)
Offline
hey,
i just did some reading and figured out, that both sites of a pipe are executed in their own subshell. So the second process with the same name is basically just the subshell executing the while-loop. So nothing to worry ;-)
Ah excellent, knopwob. Thank you for your help, and everyone else also :-).
Love this community.
- m
Offline
Love this community.
Then please give some back and mark the thread as solved: it will make it easier for others to find the solution in future...
http://wiki.archlinux.org/index.php/For … ow_to_Post
Offline
good to hear you fixed the problem. as a side note, there's also "XMonad.Util.SpawnOnce" in xmonad-contrib-darcs that may do what you want. it's what i use for my external dzen scripts (i used to start them from .xinitrc before i found this).
Offline