Cleaning up.
This commit is contained in:
1 parent
14334122bc
commit
aa1302c1bb
2 files changed
+3
-9
No files matched your search
@@ -179,8 +179,9 @@ given (lc((conf_get('database:format'))[0][0])) {
|
|||||||
|
|
||||||
if (!-e "$Bin/../etc/".(conf_get('database:filename'))[0][0]) {
|
if (!-e "$Bin/../etc/".(conf_get('database:filename'))[0][0]) {
|
||||||
# Create <database:filename> if it's missing.
|
# Create <database:filename> if it's missing.
|
||||||
system "touch $Bin/../etc/".(conf_get('database:filename'))[0][0];
|
open my $dbfh, '>', "$Bin/../etc/".(conf_get('database:filename'))[0][0];
|
||||||
system "chmod a+x $Bin/../etc/".(conf_get('database:filename'))[0][0];
|
close $dbfh;
|
||||||
|
chmod 0755, "$Bin/../etc/".(conf_get('database:filename'))[0][0];
|
||||||
}
|
}
|
||||||
# Connect to database.
|
# Connect to database.
|
||||||
$DB = DBI->connect("dbi:SQLite:dbname=$Bin/../etc/".(conf_get('database:filename'))[0][0]) or err(2, 'Failed to connect to database!', 1);
|
$DB = DBI->connect("dbi:SQLite:dbname=$Bin/../etc/".(conf_get('database:filename'))[0][0]) or err(2, 'Failed to connect to database!', 1);
|
||||||
@@ -312,9 +313,6 @@ if (!$DEBUG) {
|
|||||||
$APID = fork;
|
$APID = fork;
|
||||||
if ($APID != 0) {
|
if ($APID != 0) {
|
||||||
alog '* Successfully forked into the background. Process ID: '.$APID;
|
alog '* Successfully forked into the background. Process ID: '.$APID;
|
||||||
if (!-e "$Bin/auto.pid") {
|
|
||||||
system "touch $Bin/auto.pid";
|
|
||||||
}
|
|
||||||
open my $FPID, '>', "$Bin/auto.pid" or exit;
|
open my $FPID, '>', "$Bin/auto.pid" or exit;
|
||||||
print {$FPID} "$APID\n" or exit;
|
print {$FPID} "$APID\n" or exit;
|
||||||
close $FPID or exit;
|
close $FPID or exit;
|
||||||
|
|||||||
@@ -59,10 +59,6 @@ sub alog
|
|||||||
if (!-d "$Auto::Bin/../var") {
|
if (!-d "$Auto::Bin/../var") {
|
||||||
mkdir "$Auto::Bin/../var", 0600; ## no critic qw(ValuesAndExpressions::ProhibitMagicNumbers)
|
mkdir "$Auto::Bin/../var", 0600; ## no critic qw(ValuesAndExpressions::ProhibitMagicNumbers)
|
||||||
}
|
}
|
||||||
# Create var/DATE.log if it doesn't exist.
|
|
||||||
if (!-e "$Auto::Bin/../var/$date.log") {
|
|
||||||
system "touch $Auto::Bin/../var/$date.log";
|
|
||||||
}
|
|
||||||
|
|
||||||
# Open the logfile, print the log message to it and close it.
|
# Open the logfile, print the log message to it and close it.
|
||||||
open my $FLOG, '>>', "$Auto::Bin/../var/$date.log" or return;
|
open my $FLOG, '>>', "$Auto::Bin/../var/$date.log" or return;
|
||||||
|
|||||||
Reference in new issue
Block a user