This commit is contained in:
Jonathan Santis 2024-09-11 12:02:23 +02:00
parent ffe88a7133
commit 9673555dd9
2 changed files with 15 additions and 11 deletions

16
main.c
View File

@ -88,7 +88,7 @@ int main(int argc,char *argv[])
} }
else else
{ {
fprintf(stderr,"config requires a config file as argument"); fprintf(stderr,"config requires a config file as argument\n");
} }
} }
else else
@ -165,7 +165,7 @@ int GetSendStatus(DBusConnection *connection,char *objectpath)
} }
else else
{ {
fprintf(stderr,"could not call systemdunit"); fprintf(stderr,"could not call systemdunit\n");
} }
return ret; return ret;
} }
@ -216,7 +216,7 @@ int gotify_message(char *url,char *title,char *message)
} }
else else
{ {
fprintf(stderr,"error connecting strings for url and token"); fprintf(stderr,"error connecting strings for url and token\n");
} }
} }
@ -397,7 +397,7 @@ int systemdUnitCall(DBusConnection *connection,char *target,char *method,char *p
dbus_message_iter_init_append(msg,&iter); dbus_message_iter_init_append(msg,&iter);
if(!dbus_message_iter_append_basic(&iter,DBUS_TYPE_STRING,&param2)) if(!dbus_message_iter_append_basic(&iter,DBUS_TYPE_STRING,&param2))
{ {
fprintf(stderr,"Error appending"); fprintf(stderr,"Error appending\n");
return -1; return -1;
} }
else{ else{
@ -405,7 +405,7 @@ int systemdUnitCall(DBusConnection *connection,char *target,char *method,char *p
} }
if(!dbus_message_iter_append_basic(&iter,DBUS_TYPE_STRING,&param)) if(!dbus_message_iter_append_basic(&iter,DBUS_TYPE_STRING,&param))
{ {
fprintf(stderr,"Error appending"); fprintf(stderr,"Error appending\n");
return -1; return -1;
} }
else{ else{
@ -488,9 +488,3 @@ int systemdUnitCall(DBusConnection *connection,char *target,char *method,char *p
return 0; return 0;
} }
/*
int checkIsActive(DBusConnection *connection, char *service_name)
{
systemdCall(connection,
}*/

10
systemd-gotify.service Normal file
View File

@ -0,0 +1,10 @@
[Unit]
Description=Check for running systemd daemons and send notification to gotify
User=ccppi
[Service]
WorkingDirectory=/home/ccppi/Programming/systemd-gotify/
ExecStart=/home/ccppi/Programming/systemd-gotify/a.out config config
[Install]
WantedBy=multi-user.target