1
0

debug of systemd service and logfile search

This commit is contained in:
Daniel Tartavel 2020-05-18 20:20:30 +02:00
parent 2f03f2fcdd
commit 104539f763
2 changed files with 6 additions and 5 deletions

6
main.c
View File

@ -140,6 +140,7 @@ int readconfig( struct config * cfg )
strcpy(cfg->logfile, "/dev/null"); strcpy(cfg->logfile, "/dev/null");
retval += 2; retval += 2;
} }
printf("logfile not found, defaulting to %s\n", cfg->logfile);
} }
if (cfg->hostname[0] == 0 ) if (cfg->hostname[0] == 0 )
{ {
@ -151,16 +152,18 @@ int readconfig( struct config * cfg )
{ {
strcpy(cfg->hostname, HOSTNAME); strcpy(cfg->hostname, HOSTNAME);
} }
printf("hostname not found, defaulting to %s\n", cfg->hostname);
} }
if (cfg->commande[0] == 0) if (cfg->commande[0] == 0)
{ {
if (debug >=1) printf("command not found in config file: no command will be executed\n"); printf("command not found in config file: no command will be executed\n");
retval += 4; retval += 4;
} }
return retval; return retval;
} }
//test if pid is in list of known sshd processus //test if pid is in list of known sshd processus
// return number of pid
int isinarray( int pid, int array[], int n ) int isinarray( int pid, int array[], int n )
{ {
int x; int x;
@ -174,6 +177,7 @@ int isinarray( int pid, int array[], int n )
return 0; return 0;
} }
// return date in localized format
char* frtime(const time_t timet) char* frtime(const time_t timet)
{ {
struct tm *date_tm; struct tm *date_tm;

View File

@ -4,10 +4,7 @@ After=sshd.service
[Service] [Service]
Type=simple Type=simple
WorkingDirectory=/root
User=daemon
Group=daemon
ExecStart=/usr/bin/sshdetect ExecStart=/usr/bin/sshdetect
Restart=always Restart=always