Changeset 414
- Timestamp:
- 11/16/11 09:46:41 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tools/trunk/bin/sophie-notify
r412 r414 12 12 13 13 GetOptions( 14 'c=s' => \my $configfile, 15 'bdelay=i' => \my $updated_inotify, 16 'd|daemon' => \my $daemon, 17 'u|url=s' => \my $server, 18 'l=s' => \my $login, 19 'p=s' => \my $pass, 20 'proxy=s' => \my $proxy, 14 'c=s' => \my $configfile, 15 'bdelay=i' => \my $updated_inotify, 16 'd|daemon' => \my $daemon, 17 'u|url=s' => \my $server, 18 'l=s' => \my $login, 19 'p=s' => \my $pass, 20 'proxy=s' => \my $proxy, 21 'pidfile=s' => \my $pidfile, 22 'runas=s' => \my $runas, 21 23 ) or die "Wrong options"; 22 24 … … 29 31 $pass ||= $config{pass}; 30 32 $proxy ||= $config{proxy}; 33 $pidfile ||= $config{pidfile}; 34 $runas ||= $config{runas}; 31 35 } 32 36 33 37 $updated_inotify ||= 500; 38 39 my $sc = Sophie::Client->new( 40 server => $server, 41 login => $login, 42 password => $pass, 43 proxy => $proxy, 44 ) or die "Can't access to sophie web site"; 45 46 if ($runas) { 47 my ($login,$pass,$uid,$gid) = $runas =~ /^\d/ 48 ? getpwuid($runas) 49 : getpwnam($runas); 50 51 $> = $uid; $) = $gid; 52 if ($> ne $uid) { 53 die "Cannot change to user $runas\n"; 54 } 55 } 56 34 57 35 58 if ($daemon) { … … 39 62 } 40 63 41 my $sc = Sophie::Client->new( 42 server => $server, 43 login => $login, 44 password => $pass, 45 proxy => $proxy, 46 ); 64 if ($pidfile) { 65 if (open(my $handle, '>', $pidfile)) { 66 print $handle $$ . "\n"; 67 close($handle); 68 } else { 69 } 70 } 47 71 48 72 my $update = 1;
Note: See TracChangeset
for help on using the changeset viewer.