--- On Thu, 10/16/08, Patrick O'Callaghan <pocallaghan@xxxxxxxxx> wrote: > From: Patrick O'Callaghan <pocallaghan@xxxxxxxxx> > Subject: Re: how can I make sure only one instance of gkrellm runs > To: fedora-list@xxxxxxxxxx > Date: Thursday, October 16, 2008, 4:08 PM > On Thu, 2008-10-16 at 15:56 -0700, Antonio Olivares wrote: > > Dear fellow Fedoreans, > > > > How can I make sure that only one instance of gkrellm > runs. When I start one of my machines run several instances > of gkrellm. I chose in the configuration run only one, but > that does not work :( > > > > [olivares@localhost ~]$ whoami > > olivares > > [olivares@localhost ~]$ top > > top - 17:51:33 up 1:36, 4 users, load average: > 0.36, 0.50, 0.68 > > Tasks: 130 total, 1 running, 129 sleeping, 0 > stopped, 0 zombie > > Cpu(s): 4.7%us, 1.0%sy, 0.0%ni, 94.4%id, 0.0%wa, > 0.0%hi, 0.0%si, 0.0%st > > Mem: 773348k total, 712732k used, 60616k free, > 23792k buffers > > Swap: 3114416k total, 80k used, 3114336k free, > 398188k cached > > > > PID USER PR NI VIRT RES SHR S %CPU %MEM > TIME+ COMMAND > > 2440 root 20 0 216m 63m 7200 S 3.3 8.4 > 6:00.98 Xorg > > 2986 olivares 20 0 23088 9832 6528 S 1.0 1.3 > 0:55.45 gkrellm > > 3008 olivares 20 0 23056 9868 6556 S 1.0 1.3 > 0:54.94 gkrellm > > 2944 olivares 20 0 103m 23m 15m S 0.7 3.1 > 0:18.71 plasma > > 2968 olivares 20 0 23088 9832 6528 S 0.7 1.3 > 0:55.39 gkrellm > > 2978 olivares 20 0 23088 9828 6528 S 0.7 1.3 > 0:55.75 gkrellm > > 2993 olivares 20 0 23088 9836 6528 S 0.7 1.3 > 0:55.34 gkrellm > > 3000 olivares 20 0 23088 9832 6528 S 0.7 1.3 > 0:55.55 gkrellm > > 554 root 15 -5 0 0 0 S 0.3 0.0 > 0:04.96 scsi_eh_1 > > 2936 olivares 20 0 60492 16m 12m S 0.3 2.2 > 0:07.61 kwin > > 20164 olivares 20 0 73576 15m 11m S 0.3 2.0 > 0:00.27 konsole > > 1 root 20 0 2016 848 636 S 0.0 0.1 > 0:04.38 init > > 2 root 15 -5 0 0 0 S 0.0 0.0 > 0:00.00 kthreadd > > > > As you can see there are several gkrellm's running > :( > > > > Cameron shared a script with me: > > > > #!/bin/bash > > # > > pidfile=$HOME/.grkrellm.pid > > if [ -s "$pidfile" ] && > pid=$(<"$pidfile") && kill -0 > "$pid" 2>/dev/null > > then > > echo GKrellM already running, pid=$pid, not > starting a new one. > > else > > gkrellm & # start gkrellm > > echo $! >"$pidfile" # save the pid > > fi > > > > > > And it finds that gkrellm is already running so it > quits. The script works, but I have to find a way to > eliminate the extra gkrellm's. > > How can I prevent the other gkrellm's and run only > one? > > 1) You don't say how you run the script. I don't run the script. I only run it to check to see if gkrellm is running. Since gkrellm starts by itself I do not run the script. What I did before was run $ killall -9 gkrellm and then start gkrellm manually so it would run. But that process is getting boring and tiring. I would like for it to run by itself only one instance and not all those times that it runs :( > 2) What does "kill -0" do? "man kill" > doesn't mention this possibilty. > 3) The script has an obvious race condition, (i.e. if run > from several > places simultaneously, there is a non-zero probability of > starting more > than one process). This is because running the process and > creating the > pidfile are two separate actions. > > poc > > -- The file was set to run automatically when starting one of the two desktops. I ran Gnome for a good while when KDE 4 was coming out, I switched to it to learn more about it, went back to gnome and since Fedora 9 came out and all the wonderful updates came up for KDE 4.1.1 and KDE 4.1.2 came out I have been running it. It is no longer on ~/.kde/Autostart/gkrellm or ln -s /usr/bin/gkrellm on it. When I log in, gkrellm starts by itself. I have the don't allow multiple instances of it, but it still runs many copies simultaneously :( That is the problem. How can I make sure only one gkrellm runs and get rid of all the others once and for all. Thank you for helping in trying to resolve this issue. Regards, Antonio -- fedora-list mailing list fedora-list@xxxxxxxxxx To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines