Compare commits
3 commits
415d0b7a85
...
1384f90765
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1384f90765 | ||
|
|
8e6e181658 | ||
|
|
3eb14518de |
2 changed files with 10 additions and 4 deletions
2
d3d.rc
Normal file → Executable file
2
d3d.rc
Normal file → Executable file
|
|
@ -9,5 +9,5 @@ fct 32
|
||||||
statusfile d3d/irena-status
|
statusfile d3d/irena-status
|
||||||
datafile d3d/irena-%Y-%m-%dT%H:%M:%SZ.dat
|
datafile d3d/irena-%Y-%m-%dT%H:%M:%SZ.dat
|
||||||
counterfile d3d/irena-%Y-%m-%dT%H:%M:%SZ.hst
|
counterfile d3d/irena-%Y-%m-%dT%H:%M:%SZ.hst
|
||||||
socket unix irena-control interactive
|
socket unix irena-control interactive force
|
||||||
cron next init 60 irena pres/inj
|
cron next init 60 irena pres/inj
|
||||||
|
|
|
||||||
12
irena.c
12
irena.c
|
|
@ -2372,6 +2372,11 @@ void print_asocket(FILE *mout)
|
||||||
|
|
||||||
int open_cmd_socket(int na, char **av)
|
int open_cmd_socket(int na, char **av)
|
||||||
{
|
{
|
||||||
|
int force = 0;
|
||||||
|
if (!strcmp(av[na-1], "force")) {
|
||||||
|
na--;
|
||||||
|
force = 1;
|
||||||
|
}
|
||||||
if (!strcmp(av[na-1], "close")) {
|
if (!strcmp(av[na-1], "close")) {
|
||||||
na--;
|
na--;
|
||||||
close_cmd_socket();
|
close_cmd_socket();
|
||||||
|
|
@ -2402,6 +2407,8 @@ int open_cmd_socket(int na, char **av)
|
||||||
else if (na==2 || na==3 && !strcmp(av[1], "unix")) {
|
else if (na==2 || na==3 && !strcmp(av[1], "unix")) {
|
||||||
cmd_socket_addr.u.sun_family = AF_UNIX;
|
cmd_socket_addr.u.sun_family = AF_UNIX;
|
||||||
strncpy(cmd_socket_addr.u.sun_path, av[na-1], sizeof(cmd_socket_addr.u.sun_path)-1);
|
strncpy(cmd_socket_addr.u.sun_path, av[na-1], sizeof(cmd_socket_addr.u.sun_path)-1);
|
||||||
|
if (force && !unlink(cmd_socket_addr.u.sun_path))
|
||||||
|
fprintf(mout, "socket «%s» unlinked\n", cmd_socket_addr.u.sun_path);
|
||||||
}
|
}
|
||||||
else if (na==1) {
|
else if (na==1) {
|
||||||
is_open:
|
is_open:
|
||||||
|
|
@ -2422,11 +2429,10 @@ int open_cmd_socket(int na, char **av)
|
||||||
merror("socket");
|
merror("socket");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (cmd_socket_is_inet())
|
if (force && cmd_socket_is_inet())
|
||||||
setsockopt(cmd_socket_fd, SOL_SOCKET, SO_REUSEADDR, &(int){1}, sizeof(int));
|
setsockopt(cmd_socket_fd, SOL_SOCKET, SO_REUSEADDR, &(int){1}, sizeof(int));
|
||||||
|
|
||||||
if (bind(cmd_socket_fd, &cmd_socket_addr.g, sizeof(cmd_socket_addr.u))<0) {
|
if (bind(cmd_socket_fd, &cmd_socket_addr.g, sizeof(cmd_socket_addr.u))<0) {
|
||||||
|
|
||||||
merror("bind");
|
merror("bind");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
@ -2720,7 +2726,7 @@ int process_cmd(char *l)
|
||||||
"\tstatusfile [«fn» [ «rotate» [ «rotate-modulus» [«flags»]]]] [close|rotate]\n"
|
"\tstatusfile [«fn» [ «rotate» [ «rotate-modulus» [«flags»]]]] [close|rotate]\n"
|
||||||
"\tdatarate [«index» [«rate» [«i-rate» [«burst» [«flags»]]]]] [reset]\n"
|
"\tdatarate [«index» [«rate» [«i-rate» [«burst» [«flags»]]]]] [reset]\n"
|
||||||
"\tlimits «index» [ «red-low» «yellow-low» «yellow-high» «red-high» ]\n"
|
"\tlimits «index» [ «red-low» «yellow-low» «yellow-high» «red-high» ]\n"
|
||||||
"\tsocket [unix «path»|tcp «port»] [interactive|noninteractive] [close]\n"
|
"\tsocket [unix «path»|tcp «port»] [interactive|noninteractive] [close] [force]\n"
|
||||||
"\tpath [«name» [«value»]]\n"
|
"\tpath [«name» [«value»]]\n"
|
||||||
"\tcron [«index» [«flags»… [«delay» «cmd»]]]\n"
|
"\tcron [«index» [«flags»… [«delay» «cmd»]]]\n"
|
||||||
"\tcron force «flags»… [«times»]\n"
|
"\tcron force «flags»… [«times»]\n"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue