summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain d'Alverny <rdalverny@mandriva.org>2005-01-31 16:20:46 +0000
committerRomain d'Alverny <rdalverny@mandriva.org>2005-01-31 16:20:46 +0000
commit9aa5a8448fab90e9253131322e03db3a7c832619 (patch)
treeb1efeffe5efbd9aa4535bf82d2519a53e3899792
parent674676f0b791e9dce5360caafd80751d15e9a895 (diff)
downloadmgaonline-9aa5a8448fab90e9253131322e03db3a7c832619.tar
mgaonline-9aa5a8448fab90e9253131322e03db3a7c832619.tar.gz
mgaonline-9aa5a8448fab90e9253131322e03db3a7c832619.tar.bz2
mgaonline-9aa5a8448fab90e9253131322e03db3a7c832619.tar.xz
mgaonline-9aa5a8448fab90e9253131322e03db3a7c832619.zip
Moved is_running to mdkonline.pm. Added is_running call to mdkupdate.
-rwxr-xr-xmdkapplet10
-rw-r--r--mdkonline.pm9
-rwxr-xr-xmdkupdate2
3 files changed, 12 insertions, 9 deletions
diff --git a/mdkapplet b/mdkapplet
index c5afa29a..3dadad97 100755
--- a/mdkapplet
+++ b/mdkapplet
@@ -53,7 +53,7 @@ my $localfile = "$localdir/mdkonline";
mkdir_p($localdir) if !-d $localdir;
-e "$ENV{HOME}/.mdkonline" and system("mv", "$ENV{HOME}/.mdkonline", $localfile);
-is_running('mdkapplet') and die "mdkapplet already running\n";
+mdkonline::is_running('mdkapplet') and die "mdkapplet already running\n";
my %state = (
okay => {
@@ -294,14 +294,6 @@ sub compareWithInstalled {
}
$isUpdate
}
-sub is_running {
- my ($name) = @_;
- any {
- my ($ppid, $pid, $n) = /^\s*(\d+)\s+(\d+)\s+(.*)/;
- #- to run ps, perl may create some process with $name as name and 1 as ppid
- $ppid != 1 && $pid != $$ && $n eq $name;
- } `ps -o '%P %p %c' -u $ENV{USER}`;
-}
sub cronUpdate {
Glib::Timeout->add(10*1000, sub {
checkConfig();
diff --git a/mdkonline.pm b/mdkonline.pm
index 3b15b72b..d1d4d0eb 100644
--- a/mdkonline.pm
+++ b/mdkonline.pm
@@ -221,4 +221,13 @@ LASTCHECK=$d
);
}
+sub is_running {
+ my ($name) = @_;
+ any {
+ my ($ppid, $pid, $n) = /^\s*(\d+)\s+(\d+)\s+(.*)/;
+ #- to run ps, perl may create some process with $name as name and 1 as ppid
+ $ppid != 1 && $pid != $$ && $n eq $name;
+ } `ps -o '%P %p %c' -u $ENV{USER}`;
+}
+
1;
diff --git a/mdkupdate b/mdkupdate
index c0b04595..fbc07090 100755
--- a/mdkupdate
+++ b/mdkupdate
@@ -27,6 +27,8 @@ use mdkonline;
BEGIN { unshift @::textdomains, 'mdkupdate' }
+mdkonline::is_running('mdkupdate') and die "mdkupdate already running\n";
+
require_root_capability();
my $confdir = '/root/.MdkOnline';