summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 0f95971)
raw | patch | inline | side by side (parent: 0f95971)
author | opensides <opensides@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Sat, 27 Mar 2010 23:07:12 +0000 (23:07 +0000) | ||
committer | opensides <opensides@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Sat, 27 Mar 2010 23:07:12 +0000 (23:07 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@17314 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-si/gosa-si-client | patch | blob | history | |
gosa-si/gosa-si-server | patch | blob | history |
diff --git a/gosa-si/gosa-si-client b/gosa-si/gosa-si-client
index 9417ecb16a6d00b29de1ad71887647951b0a405d..49756c38aedf229af59aead2afeac0d026a629c9 100755 (executable)
--- a/gosa-si/gosa-si-client
+++ b/gosa-si/gosa-si-client
# REVISION: ---
#===============================================================================
-my $client_version = '$HeadURL$:$Rev$';
-
use strict;
use warnings;
use Getopt::Long;
# Workaround: need pure perl to make it work with UTF-8 :-(
$XML::Simple::PREFERRED_PARSER= "XML::SAX::PurePerl";
+my $client_version = '$HeadURL$:$Rev$';
+
my $client_headURL;
my $client_revision;
my $client_status;
sub check_pid {
$pid = -1;
# Check, if we are already running
- if( open(LOCK_FILE, "<$pid_file") ) {
- $pid = <LOCK_FILE>;
+ if( open($LOCK_FILE, "<","$pid_file") ) {
+ $pid = <$LOCK_FILE>;
if( defined $pid ) {
chomp( $pid );
if( -f "/proc/$pid/stat" ) {
my($stat) = `cat /proc/$pid/stat` =~ m/$pid \((.+)\).*/;
if( $0 eq $stat ) {
- close( LOCK_FILE );
+ close( $LOCK_FILE );
exit -1;
}
}
}
- close( LOCK_FILE );
+ close( $LOCK_FILE );
unlink( $pid_file );
}
# create a syslog msg if it is not to possible to open PID file
if (not sysopen(LOCK_FILE, $pid_file, O_WRONLY|O_CREAT|O_EXCL, 0644)) {
my($msg) = "Couldn't obtain lockfile '$pid_file' ";
- if (open(LOCK_FILE, '<', $pid_file)
- && ($pid = <LOCK_FILE>))
+ if (open($LOCK_FILE, '<', $pid_file)
+ && ($pid = <$LOCK_FILE>))
{
chomp($pid);
$msg .= "(PID $pid)\n";
if($server_ip =~ /^(\d\d?\d?\.){3}\d\d?\d?$/) {
my $PROC_NET_ROUTE= ('/proc/net/route');
- open(PROC_NET_ROUTE, "<$PROC_NET_ROUTE")
+ open($PROC_NET_ROUTE, "<","$PROC_NET_ROUTE")
or die "Could not open $PROC_NET_ROUTE";
- my @ifs = <PROC_NET_ROUTE>;
+ my @ifs = <$PROC_NET_ROUTE>;
- close(PROC_NET_ROUTE);
+ close($PROC_NET_ROUTE);
# Eat header line
shift @ifs;
chomp($string);
- if (open(FILE, ">> $file")){
- print FILE $string."\n";
- close(FILE);
+ if (open($FILE, ">>", "$file")){
+ print $FILE $string."\n";
+ close($FILE);
}
}
- return;
+ return;
}
# Check if file has 'seen' tag
foreach my $goto_file (@goto_files) {
- open(FILE, "$goto_dir/$goto_file");
- my @lines = <FILE>;
- close FILE;
+ open($FILE, "$goto_dir/$goto_file");
+ my @lines = <$FILE>;
+ close($FILE);
my $source;
my $target;
next;
}
- open(FILE, "<$log_file");
- my @lines = <FILE> ;
- close (FILE);
+ open($FILE, "<","$log_file");
+ my @lines = <$FILE> ;
+ close ($FILE);
my $log_string = join("", @lines);
$log .= &encode_base64($log_string);
push(@log_list, $log);
# Do something useful - put our PID into the pid_file
if( 0 != $pid ) {
- open( LOCK_FILE, ">$pid_file" );
- print LOCK_FILE "$pid\n";
- close( LOCK_FILE );
+ open( $LOCK_FILE, ">","$pid_file" );
+ print $LOCK_FILE "$pid\n";
+ close( $LOCK_FILE );
if( !$foreground ) {
exit( 0 )
};
diff --git a/gosa-si/gosa-si-server b/gosa-si/gosa-si-server
index cf721b234e522445a3ea15a6620e99fe85123e09..e820b24940a2ad25dddadef16ac358b9433da52b 100755 (executable)
--- a/gosa-si/gosa-si-server
+++ b/gosa-si/gosa-si-server
# REVISION: ---
#===============================================================================
-my $server_version = '$HeadURL: https://oss.gonicus.de/repositories/gosa/trunk/gosa-si/gosa-si-server $:$Rev$';
-
use strict;
use warnings;
use Getopt::Long;
use Net::LDAP;
use Net::LDAP::Util qw(:escape);
+my $server_version = '$HeadURL: https://oss.gonicus.de/repositories/gosa/trunk/gosa-si/gosa-si-server $:$Rev$';
# revision number of server and program name
my $server_headURL;
sub check_pid {
$pid = -1;
# Check, if we are already running
- if( open(LOCK_FILE, "<$pid_file") ) {
- $pid = <LOCK_FILE>;
+ if( open($LOCK_FILE, "<","$pid_file") ) {
+ $pid = <$LOCK_FILE>;
if( defined $pid ) {
chomp( $pid );
if( -f "/proc/$pid/stat" ) {
my($stat) = `cat /proc/$pid/stat` =~ m/$pid \((.+)\).*/;
if( $stat ) {
print STDERR "\nERROR: Already running!\n";
- close( LOCK_FILE );
+ close( $LOCK_FILE );
exit -1;
}
}
# create a syslog msg if it is not to possible to open PID file
if (not sysopen(LOCK_FILE, $pid_file, O_WRONLY|O_CREAT|O_EXCL, 0644)) {
my($msg) = "Couldn't obtain lockfile '$pid_file' ";
- if (open(LOCK_FILE, '<', $pid_file)
- && ($pid = <LOCK_FILE>))
+ if (open($LOCK_FILE, '<', $pid_file)
+ && ($pid = <$LOCK_FILE>))
{
chomp($pid);
$msg .= "(PID $pid)\n";
}
my $fh;
- open($fh, ">$result");
+ open($fh, ">","$result");
if (not defined $fh) {
&main::daemon_log("$session_id DEBUG: cannot open '$result' for writing", 7);
return undef;
my $line;
- open(CONFIG, "<$sources_file") or do {
+ open($CONFIG, "<","$sources_file") or do {
daemon_log( "$session_id ERROR: create_packages_list_db: Failed to open '$sources_file'", 1);
unlink($packages_list_under_construction);
return;
}
}
- close (CONFIG);
+ close ($CONFIG);
if(keys(%repo_dirs)) {
find(\&cleanup_and_extract, keys( %repo_dirs ));
return;
}
- open($PACKAGES, "<$path.in");
+ open($PACKAGES, "<","$path.in");
if(not defined($PACKAGES)) {
daemon_log("$session_id ERROR: create_packages_list_db: parse_package: cannot open '$path.in'",1);
return;
my $tmpl= ""; {
local $/=undef;
- open FILE, "$dir/DEBIAN/templates";
+ open($FILE, "$dir/DEBIAN/templates");
$tmpl = &encode_base64(<FILE>);
- close FILE;
+ close($FILE);
}
rmtree("$dir/DEBIAN/templates");
# Do something useful - put our PID into the pid_file
if( 0 != $pid ) {
- open( LOCK_FILE, ">$pid_file" );
- print LOCK_FILE "$pid\n";
- close( LOCK_FILE );
+ open( $LOCK_FILE, ">","$pid_file" );
+ print $LOCK_FILE "$pid\n";
+ close( $LOCK_FILE );
if( !$foreground ) {
exit( 0 )
};
# Prepare log file and set permissions
$root_uid = getpwnam('root');
$adm_gid = getgrnam('adm');
-open(FH, ">>$log_file");
-close FH;
+open($FH, ">>","$log_file");
+close($FH);
chmod(0440, $log_file);
chown($root_uid, $adm_gid, $log_file);
chown($root_uid, $adm_gid, "/var/lib/gosa-si");