how can I make sure only one instance of gkrellm runs
Antonio Olivares
olivares14031 at yahoo.com
Thu Oct 16 22:56:56 UTC 2008
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 at localhost ~]$ whoami
olivares
[olivares at 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?
TIA,
Antonio
More information about the fedora-list
mailing list