diff -Nru restartd-0.2.2/LICENCE restartd-0.2.3/LICENCE --- restartd-0.2.2/LICENCE 2002-01-03 23:28:04.000000000 +0000 +++ restartd-0.2.3/LICENCE 1970-01-01 00:00:00.000000000 +0000 @@ -1,280 +0,0 @@ -GNU GENERAL PUBLIC LICENSE - - Version 2, June 1991 -Copyright (C) 1989, 1991 Free Software Foundation, Inc. -59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - -Everyone is permitted to copy and distribute verbatim copies -of this license document, but changing it is not allowed. - -Preamble - - The licenses for most software are designed to take away your freedom - to share and change it. By contrast, the GNU General Public License is - intended to guarantee your freedom to share and change free - software--to make sure the software is free for all its users. This - General Public License applies to most of the Free Software - Foundation's software and to any other program whose authors commit to - using it. (Some other Free Software Foundation software is covered by - the GNU Library General Public License instead.) You can apply it to - your programs, too. - - When we speak of free software, we are referring to freedom, not - price. Our General Public Licenses are designed to make sure that you - have the freedom to distribute copies of free software (and charge for - this service if you wish), that you receive source code or can get it - if you want it, that you can change the software or use pieces of it - in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid - anyone to deny you these rights or to ask you to surrender the rights. - These restrictions translate to certain responsibilities for you if - you distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether - gratis or for a fee, you must give the recipients all the rights that - you have. You must make sure that they, too, receive or can get the - source code. And you must show them these terms so they know their - rights. - - We protect your rights with two steps: (1) copyright the software, and - (2) offer you this license which gives you legal permission to copy, - distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain - that everyone understands that there is no warranty for this free - software. If the software is modified by someone else and passed on, - we want its recipients to know that what they have is not the - original, so that any problems introduced by others will not reflect - on the original authors' reputations. - - Finally, any free program is threatened constantly by software - patents. We wish to avoid the danger that redistributors of a free - program will individually obtain patent licenses, in effect making the - program proprietary. To prevent this, we have made it clear that any - patent must be licensed for everyone's free use or not licensed at - all. - - The precise terms and conditions for copying, distribution and - modification follow. - -TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains a - notice placed by the copyright holder saying it may be distributed - under the terms of this General Public License. The "Program", below, - refers to any such program or work, and a "work based on the Program" - means either the Program or any derivative work under copyright law: - that is to say, a work containing the Program or a portion of it, - either verbatim or with modifications and/or translated into another - language. (Hereinafter, translation is included without limitation in - the term "modification".) Each licensee is addressed as "you". - - Activities other than copying, distribution and modification are not - covered by this License; they are outside its scope. The act of - running the Program is not restricted, and the output from the Program - is covered only if its contents constitute a work based on the Program - (independent of having been made by running the Program). Whether that - is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's source - code as you receive it, in any medium, provided that you conspicuously - and appropriately publish on each copy an appropriate copyright notice - and disclaimer of warranty; keep intact all the notices that refer to - this License and to the absence of any warranty; and give any other - recipients of the Program a copy of this License along with the - Program. - - You may charge a fee for the physical act of transferring a copy, and - you may at your option offer warranty protection in exchange for a - fee. - - 2. You may modify your copy or copies of the Program or any portion of - it, thus forming a work based on the Program, and copy and distribute - such modifications or work under the terms of Section 1 above, - provided that you also meet all of these conditions: - - * a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - * b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - * c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but does - not normally print such an announcement, your work based on the - Program is not required to print an announcement.) - - These requirements apply to the modified work as a whole. If - identifiable sections of that work are not derived from the Program, - and can be reasonably considered independent and separate works in - themselves, then this License, and its terms, do not apply to those - sections when you distribute them as separate works. But when you - distribute the same sections as part of a whole which is a work based - on the Program, the distribution of the whole must be on the terms of - this License, whose permissions for other licensees extend to the - entire whole, and thus to each and every part regardless of who wrote - it. - - Thus, it is not the intent of this section to claim rights or contest - your rights to work written entirely by you; rather, the intent is to - exercise the right to control the distribution of derivative or - collective works based on the Program. - - In addition, mere aggregation of another work not based on the Program - with the Program (or with a work based on the Program) on a volume of - a storage or distribution medium does not bring the other work under - the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, - under Section 2) in object code or executable form under the terms of - Sections 1 and 2 above provided that you also do one of the following: - * a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software - interchange; or, - * b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - * c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - - The source code for a work means the preferred form of the work for - making modifications to it. For an executable work, complete source - code means all the source code for all modules it contains, plus any - associated interface definition files, plus the scripts used to - control compilation and installation of the executable. However, as a - special exception, the source code distributed need not include - anything that is normally distributed (in either source or binary - form) with the major components (compiler, kernel, and so on) of the - operating system on which the executable runs, unless that component - itself accompanies the executable. - - If distribution of executable or object code is made by offering - access to copy from a designated place, then offering equivalent - access to copy the source code from the same place counts as - distribution of the source code, even though third parties are not - compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program - except as expressly provided under this License. Any attempt otherwise - to copy, modify, sublicense or distribute the Program is void, and - will automatically terminate your rights under this License. However, - parties who have received copies, or rights, from you under this - License will not have their licenses terminated so long as such - parties remain in full compliance. - - 5. You are not required to accept this License, since you have not - signed it. However, nothing else grants you permission to modify or - distribute the Program or its derivative works. These actions are - prohibited by law if you do not accept this License. Therefore, by - modifying or distributing the Program (or any work based on the - Program), you indicate your acceptance of this License to do so, and - all its terms and conditions for copying, distributing or modifying - the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the - Program), the recipient automatically receives a license from the - original licensor to copy, distribute or modify the Program subject to - these terms and conditions. You may not impose any further - restrictions on the recipients' exercise of the rights granted herein. - You are not responsible for enforcing compliance by third parties to - this License. - - 7. If, as a consequence of a court judgment or allegation of patent - infringement or for any other reason (not limited to patent issues), - conditions are imposed on you (whether by court order, agreement or - otherwise) that contradict the conditions of this License, they do not - excuse you from the conditions of this License. If you cannot - distribute so as to satisfy simultaneously your obligations under this - License and any other pertinent obligations, then as a consequence you - may not distribute the Program at all. For example, if a patent - license would not permit royalty-free redistribution of the Program by - all those who receive copies directly or indirectly through you, then - the only way you could satisfy both it and this License would be to - refrain entirely from distribution of the Program. - - If any portion of this section is held invalid or unenforceable under - any particular circumstance, the balance of the section is intended to - apply and the section as a whole is intended to apply in other - circumstances. - - It is not the purpose of this section to induce you to infringe any - patents or other property right claims or to contest validity of any - such claims; this section has the sole purpose of protecting the - integrity of the free software distribution system, which is - implemented by public license practices. Many people have made - generous contributions to the wide range of software distributed - through that system in reliance on consistent application of that - system; it is up to the author/donor to decide if he or she is willing - to distribute software through any other system and a licensee cannot - impose that choice. - - This section is intended to make thoroughly clear what is believed to - be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in - certain countries either by patents or by copyrighted interfaces, the - original copyright holder who places the Program under this License - may add an explicit geographical distribution limitation excluding - those countries, so that distribution is permitted only in or among - countries not thus excluded. In such case, this License incorporates - the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new - versions of the General Public License from time to time. Such new - versions will be similar in spirit to the present version, but may - differ in detail to address new problems or concerns. - - Each version is given a distinguishing version number. If the Program - specifies a version number of this License which applies to it and - "any later version", you have the option of following the terms and - conditions either of that version or of any later version published by - the Free Software Foundation. If the Program does not specify a - version number of this License, you may choose any version ever - published by the Free Software Foundation. - - 10. If you wish to incorporate parts of the Program into other free - programs whose distribution conditions are different, write to the - author to ask for permission. For software which is copyrighted by the - Free Software Foundation, write to the Free Software Foundation; we - sometimes make exceptions for this. Our decision will be guided by the - two goals of preserving the free status of all derivatives of our free - software and of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO - WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. - EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR - OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY - KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE - PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME - THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN - WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY - AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU - FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR - CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE - PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING - RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A - FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF - SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH - DAMAGES. - -END OF TERMS AND CONDITIONS diff -Nru restartd-0.2.2/LICENSE restartd-0.2.3/LICENSE --- restartd-0.2.2/LICENSE 1970-01-01 00:00:00.000000000 +0000 +++ restartd-0.2.3/LICENSE 2013-01-13 02:27:23.000000000 +0000 @@ -0,0 +1,280 @@ +GNU GENERAL PUBLIC LICENSE + + Version 2, June 1991 +Copyright (C) 1989, 1991 Free Software Foundation, Inc. +59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + +Everyone is permitted to copy and distribute verbatim copies +of this license document, but changing it is not allowed. + +Preamble + + The licenses for most software are designed to take away your freedom + to share and change it. By contrast, the GNU General Public License is + intended to guarantee your freedom to share and change free + software--to make sure the software is free for all its users. This + General Public License applies to most of the Free Software + Foundation's software and to any other program whose authors commit to + using it. (Some other Free Software Foundation software is covered by + the GNU Library General Public License instead.) You can apply it to + your programs, too. + + When we speak of free software, we are referring to freedom, not + price. Our General Public Licenses are designed to make sure that you + have the freedom to distribute copies of free software (and charge for + this service if you wish), that you receive source code or can get it + if you want it, that you can change the software or use pieces of it + in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid + anyone to deny you these rights or to ask you to surrender the rights. + These restrictions translate to certain responsibilities for you if + you distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether + gratis or for a fee, you must give the recipients all the rights that + you have. You must make sure that they, too, receive or can get the + source code. And you must show them these terms so they know their + rights. + + We protect your rights with two steps: (1) copyright the software, and + (2) offer you this license which gives you legal permission to copy, + distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain + that everyone understands that there is no warranty for this free + software. If the software is modified by someone else and passed on, + we want its recipients to know that what they have is not the + original, so that any problems introduced by others will not reflect + on the original authors' reputations. + + Finally, any free program is threatened constantly by software + patents. We wish to avoid the danger that redistributors of a free + program will individually obtain patent licenses, in effect making the + program proprietary. To prevent this, we have made it clear that any + patent must be licensed for everyone's free use or not licensed at + all. + + The precise terms and conditions for copying, distribution and + modification follow. + +TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains a + notice placed by the copyright holder saying it may be distributed + under the terms of this General Public License. The "Program", below, + refers to any such program or work, and a "work based on the Program" + means either the Program or any derivative work under copyright law: + that is to say, a work containing the Program or a portion of it, + either verbatim or with modifications and/or translated into another + language. (Hereinafter, translation is included without limitation in + the term "modification".) Each licensee is addressed as "you". + + Activities other than copying, distribution and modification are not + covered by this License; they are outside its scope. The act of + running the Program is not restricted, and the output from the Program + is covered only if its contents constitute a work based on the Program + (independent of having been made by running the Program). Whether that + is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's source + code as you receive it, in any medium, provided that you conspicuously + and appropriately publish on each copy an appropriate copyright notice + and disclaimer of warranty; keep intact all the notices that refer to + this License and to the absence of any warranty; and give any other + recipients of the Program a copy of this License along with the + Program. + + You may charge a fee for the physical act of transferring a copy, and + you may at your option offer warranty protection in exchange for a + fee. + + 2. You may modify your copy or copies of the Program or any portion of + it, thus forming a work based on the Program, and copy and distribute + such modifications or work under the terms of Section 1 above, + provided that you also meet all of these conditions: + + * a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + * b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + * c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but does + not normally print such an announcement, your work based on the + Program is not required to print an announcement.) + + These requirements apply to the modified work as a whole. If + identifiable sections of that work are not derived from the Program, + and can be reasonably considered independent and separate works in + themselves, then this License, and its terms, do not apply to those + sections when you distribute them as separate works. But when you + distribute the same sections as part of a whole which is a work based + on the Program, the distribution of the whole must be on the terms of + this License, whose permissions for other licensees extend to the + entire whole, and thus to each and every part regardless of who wrote + it. + + Thus, it is not the intent of this section to claim rights or contest + your rights to work written entirely by you; rather, the intent is to + exercise the right to control the distribution of derivative or + collective works based on the Program. + + In addition, mere aggregation of another work not based on the Program + with the Program (or with a work based on the Program) on a volume of + a storage or distribution medium does not bring the other work under + the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, + under Section 2) in object code or executable form under the terms of + Sections 1 and 2 above provided that you also do one of the following: + * a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software + interchange; or, + * b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + * c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + + The source code for a work means the preferred form of the work for + making modifications to it. For an executable work, complete source + code means all the source code for all modules it contains, plus any + associated interface definition files, plus the scripts used to + control compilation and installation of the executable. However, as a + special exception, the source code distributed need not include + anything that is normally distributed (in either source or binary + form) with the major components (compiler, kernel, and so on) of the + operating system on which the executable runs, unless that component + itself accompanies the executable. + + If distribution of executable or object code is made by offering + access to copy from a designated place, then offering equivalent + access to copy the source code from the same place counts as + distribution of the source code, even though third parties are not + compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program + except as expressly provided under this License. Any attempt otherwise + to copy, modify, sublicense or distribute the Program is void, and + will automatically terminate your rights under this License. However, + parties who have received copies, or rights, from you under this + License will not have their licenses terminated so long as such + parties remain in full compliance. + + 5. You are not required to accept this License, since you have not + signed it. However, nothing else grants you permission to modify or + distribute the Program or its derivative works. These actions are + prohibited by law if you do not accept this License. Therefore, by + modifying or distributing the Program (or any work based on the + Program), you indicate your acceptance of this License to do so, and + all its terms and conditions for copying, distributing or modifying + the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the + Program), the recipient automatically receives a license from the + original licensor to copy, distribute or modify the Program subject to + these terms and conditions. You may not impose any further + restrictions on the recipients' exercise of the rights granted herein. + You are not responsible for enforcing compliance by third parties to + this License. + + 7. If, as a consequence of a court judgment or allegation of patent + infringement or for any other reason (not limited to patent issues), + conditions are imposed on you (whether by court order, agreement or + otherwise) that contradict the conditions of this License, they do not + excuse you from the conditions of this License. If you cannot + distribute so as to satisfy simultaneously your obligations under this + License and any other pertinent obligations, then as a consequence you + may not distribute the Program at all. For example, if a patent + license would not permit royalty-free redistribution of the Program by + all those who receive copies directly or indirectly through you, then + the only way you could satisfy both it and this License would be to + refrain entirely from distribution of the Program. + + If any portion of this section is held invalid or unenforceable under + any particular circumstance, the balance of the section is intended to + apply and the section as a whole is intended to apply in other + circumstances. + + It is not the purpose of this section to induce you to infringe any + patents or other property right claims or to contest validity of any + such claims; this section has the sole purpose of protecting the + integrity of the free software distribution system, which is + implemented by public license practices. Many people have made + generous contributions to the wide range of software distributed + through that system in reliance on consistent application of that + system; it is up to the author/donor to decide if he or she is willing + to distribute software through any other system and a licensee cannot + impose that choice. + + This section is intended to make thoroughly clear what is believed to + be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in + certain countries either by patents or by copyrighted interfaces, the + original copyright holder who places the Program under this License + may add an explicit geographical distribution limitation excluding + those countries, so that distribution is permitted only in or among + countries not thus excluded. In such case, this License incorporates + the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new + versions of the General Public License from time to time. Such new + versions will be similar in spirit to the present version, but may + differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the Program + specifies a version number of this License which applies to it and + "any later version", you have the option of following the terms and + conditions either of that version or of any later version published by + the Free Software Foundation. If the Program does not specify a + version number of this License, you may choose any version ever + published by the Free Software Foundation. + + 10. If you wish to incorporate parts of the Program into other free + programs whose distribution conditions are different, write to the + author to ask for permission. For software which is copyrighted by the + Free Software Foundation, write to the Free Software Foundation; we + sometimes make exceptions for this. Our decision will be guided by the + two goals of preserving the free status of all derivatives of our free + software and of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO + WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. + EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR + OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY + KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE + PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME + THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN + WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY + AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU + FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR + CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE + PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING + RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A + FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF + SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + DAMAGES. + +END OF TERMS AND CONDITIONS diff -Nru restartd-0.2.2/Makefile restartd-0.2.3/Makefile --- restartd-0.2.2/Makefile 2006-09-14 21:25:30.000000000 +0000 +++ restartd-0.2.3/Makefile 2013-01-13 02:27:23.000000000 +0000 @@ -3,8 +3,8 @@ C_ARGS = -Wall -O2 CC = gcc INS = /usr/bin/install - -all: restartd +VERSION = $(shell cat version) +all: restartd install: restartd $(INS) -o root -g root -m 0640 restartd.conf $(DESTDIR)/etc @@ -15,12 +15,12 @@ clean: rm -f *.o restartd -restartd: main.o config.o - $(CC) -o restartd main.o config.o -# strip restartd +restartd: main.o config.o + $(CC) -o restartd -DVERSION='"$(VERSION)"' main.o config.o +# strip restartd -main.o: main.c - $(CC) $(C_ARGS) -c main.c +main.o: main.c + $(CC) $(C_ARGS) -DVERSION='"$(VERSION)"' -c main.c -config.o: config.c - $(CC) $(C_ARGS) -c config.c +config.o: config.c + $(CC) $(C_ARGS) -DVERSION='"$(VERSION)"' -c config.c diff -Nru restartd-0.2.2/config.c restartd-0.2.3/config.c --- restartd-0.2.2/config.c 2006-09-14 17:17:39.000000000 +0000 +++ restartd-0.2.3/config.c 2013-01-13 02:27:23.000000000 +0000 @@ -22,126 +22,119 @@ #include #include "config.h" -int -read_config (void) +int read_config(void) { + FILE *config_fd; + char *line1, *line2; + int i, j, sep, lines; - FILE *config_fd; - char *line1, *line2; - int i, j, sep, lines; - - if (debug) - { - fprintf (stderr, "Config file: %s\n", config_file); + if (debug) { + fprintf(stderr, "Config file: %s\n", config_file); } - // This is a reload - if (config_process_number) - for (i = 0; i < config_process_number; i++) - { - config_process[i].name[0] = 0; - config_process[i].regexp[0] = 0; - config_process[i].running[0] = 0; - config_process[i].not_running[0] = 0; - } - - config_process_number = 0; - - line1 = (char *) malloc (1024); - line2 = (char *) malloc (1024); - - if ((config_fd = fopen (config_file, "rt")) == NULL) - { - fprintf (stderr, "Error at opening config file: %s\n", config_file); - syslog (LOG_ERR, "Error at opening config file: %s", config_file); - _exit (0); + // This is a reload + if (config_process_number) { + for(i=0; i 0) - { - line2[j] = 32; - j++; - } - } - else - { - line2[j] = line1[i]; - j++; - } - - line2[j] = 0; - - if (line2[0] != 35 && strlen (line2) > 0) - { - - j = 0; - i = 0; - lines = 0; - sep = 0; - - while (j < strlen (line2)) - { - - if (line2[j] == 32 && sep != 1) - { - line1[i] = 0; - if (debug) - { - fprintf (stderr, "%u: %s\n", lines, line1); - } - i = 0; - sep = 0; - - if (lines == 0) - snprintf (config_process[config_process_number].name, - 64, "%s", line1); - if (lines == 1) - snprintf (config_process[config_process_number]. - regexp, 128, "%s", line1); - if (lines == 2) - snprintf (config_process[config_process_number]. - not_running, 256, "%s", line1); - if (lines == 3) - snprintf (config_process[config_process_number]. - running, 256, "%s", line1); - - lines++; - } - if (line2[j] == 34) - sep++; - - if ((line2[j] != 32 || sep == 1) && line2[j] != 34) - { - line1[i] = line2[j]; - i++; - } - j++; - } + line1 = (char *) malloc(1024); + line2 = (char *) malloc(1024); - config_process_number++; - } + if ((config_fd = fopen(config_file, "rt")) == NULL) { + fprintf(stderr, "Error at opening config file: %s\n", config_file); + syslog(LOG_ERR, "Error at opening config file: %s", config_file); + _exit(0); + } + + while(fgets(line1, 1024, config_fd) != NULL) { + j = 0; + + for(i=0; i 0) { + line2[j] = 32; + j++; + } + } else { + line2[j] = line1[i]; + j++; + } + } + + line2[j] = 0; + + if (line2[0] != 35 && strlen(line2) > 0) { + j = 0; + i = 0; + lines = 0; + sep = 0; + + while(j < strlen(line2)) { + if (line2[j] == 32 && sep != 1) { + line1[i] = 0; + + if (debug) { + fprintf(stderr, "%u: %s\n", lines, line1); + } + + i = 0; + sep = 0; + + if (lines == 0) { + snprintf(config_process[config_process_number].name, + 64, "%s", line1); + } + if (lines == 1) { + snprintf(config_process[config_process_number]. + regexp, 128, "%s", line1); + } + if (lines == 2) { + snprintf(config_process[config_process_number]. + not_running, 256, "%s", line1); + } + if (lines == 3) { + snprintf(config_process[config_process_number]. + running, 256, "%s", line1); + } + + lines++; + } + + if (line2[j] == 34) { + sep++; + } + + if ((line2[j] != 32 || sep == 1) && line2[j] != 34) { + line1[i] = line2[j]; + i++; + } + + j++; + } + + config_process_number++; + } } - fclose (config_fd); + fclose(config_fd); - free (line1); - free (line2); + free(line1); + free(line2); - if (!config_process_number) - { - fprintf (stderr, "No processes defined in config file. Exiting.\n"); - syslog (LOG_INFO, "No processes defined in config file. Exiting."); - exit (0); + if (!config_process_number) { + fprintf(stderr, "No processes defined in config file. Exiting.\n"); + syslog(LOG_INFO, "No processes defined in config file. Exiting."); + exit(0); } - return 0; + return 0; } diff -Nru restartd-0.2.2/config.h restartd-0.2.3/config.h --- restartd-0.2.2/config.h 2006-09-14 17:24:55.000000000 +0000 +++ restartd-0.2.3/config.h 2013-01-13 02:27:23.000000000 +0000 @@ -19,8 +19,8 @@ // Tibor Koleszar // H-7400 Kaposvar, Somssich Pal str. 4. -#ifndef __CONFIG_H_ -#define __CONFIG_H_ +#ifndef RESTARTD_CONFIG_H +#define RESTARTD_CONFIG_H #include #include @@ -32,27 +32,23 @@ #include #define DEFAULT_CONFIG "/etc/restartd.conf" -#define VERSION "0.2.1" -int debug; // Debug +int debug; // Debug int config_process_number; int check_interval; int foreground; struct config_process_type *config_process; char *config_file; -typedef struct config_process_type -{ - +typedef struct config_process_type { char name[64]; char regexp[128]; char not_running[256]; char running[256]; char processes[256]; char status[32]; - } config_process_type; -int read_config ( /* char *config_file */ ); +int read_config(/* char *config_file */); -#endif +#endif //RESTARTD_CONFIG_H diff -Nru restartd-0.2.2/debian/changelog restartd-0.2.3/debian/changelog --- restartd-0.2.2/debian/changelog 2006-09-14 21:32:05.000000000 +0000 +++ restartd-0.2.3/debian/changelog 2013-01-13 02:52:37.000000000 +0000 @@ -1,3 +1,20 @@ +restartd (0.2.3-1) unstable; urgency=low + + * Project moved out of Debian as the scope is now broader. + * Adopting package (closes: #677775). + * [debian/control]: + - Added myself as the new maintainer. + - Updated Standards-Version to 3.9.3. + - Updated debhelper version in Build-Depends. + * [debian/source/format]: + - Moved to new format. + * [debian/init]: + - Added $remote_fs to required-start/stop, fixes lintian warning. + * [debian/watch]: + - Added pointer to github upstream. + + -- Alexandre Raymond Fri, 11 Jan 2013 11:23:51 -0500 + restartd (0.2.2) unstable; urgency=low * Fix typos in debian/control and in manpage restartd.8. diff -Nru restartd-0.2.2/debian/compat restartd-0.2.3/debian/compat --- restartd-0.2.2/debian/compat 2006-03-24 09:46:11.000000000 +0000 +++ restartd-0.2.3/debian/compat 2013-01-13 02:52:37.000000000 +0000 @@ -1 +1 @@ -4 +7 diff -Nru restartd-0.2.2/debian/control restartd-0.2.3/debian/control --- restartd-0.2.2/debian/control 2006-09-14 21:36:56.000000000 +0000 +++ restartd-0.2.3/debian/control 2013-01-13 02:52:37.000000000 +0000 @@ -1,13 +1,14 @@ Source: restartd Section: utils Priority: extra -Maintainer: Aurélien GÉRÔME -Build-Depends: debhelper (>= 4.0.0) -Standards-Version: 3.7.2 +Maintainer: Alexandre Raymond +Build-Depends: debhelper (>= 8.0.0) +Standards-Version: 3.9.3 +Homepage: https://github.com/ajraymond/restartd Package: restartd Architecture: any -Depends: ${shlibs:Depends} +Depends: ${misc:Depends}, ${shlibs:Depends} Description: Process checker and/or restarter Restartd is a daemon for checking running and not running processes. It reads the /proc directory every n seconds and does diff -Nru restartd-0.2.2/debian/init restartd-0.2.3/debian/init --- restartd-0.2.2/debian/init 2006-09-14 17:40:08.000000000 +0000 +++ restartd-0.2.3/debian/init 2013-01-13 02:52:37.000000000 +0000 @@ -6,8 +6,8 @@ ### BEGIN INIT INFO # Provides: restartd -# Required-Start: $syslog -# Required-Stop: $syslog +# Required-Start: $syslog $remote_fs +# Required-Stop: $syslog $remote_fs # Should-Start: $local_fs # Should-Stop: $local_fs # Default-Start: 2 3 4 5 @@ -34,9 +34,9 @@ echo -n "Stopping process checker: " if kill `cat /var/run/restartd.pid 2>/dev/null` >/dev/null 2>&1 then - rm -f /var/run/restartd.pid + rm -f /var/run/restartd.pid else - echo -n "not running: " + echo -n "not running: " fi echo "restartd." ;; @@ -44,9 +44,9 @@ echo -n "Stopping process checker: " if kill `cat /var/run/restartd.pid 2>/dev/null` >/dev/null 2>&1 then - rm -f /var/run/restartd.pid + rm -f /var/run/restartd.pid else - echo -n "not running: " + echo -n "not running: " fi echo "restartd." echo -n "Starting process checker: " diff -Nru restartd-0.2.2/debian/rules restartd-0.2.3/debian/rules --- restartd-0.2.2/debian/rules 2006-07-22 22:20:54.000000000 +0000 +++ restartd-0.2.3/debian/rules 2013-01-13 02:52:37.000000000 +0000 @@ -1,86 +1,14 @@ #!/usr/bin/make -f + +# -*- makefile -*- # Sample debian/rules that uses debhelper. -# GNU copyright 1997 to 1999 by Joey Hess. +# This file was originally written by Joey Hess and Craig Small. +# As a special exception, when this file is copied by dh-make into a +# dh-make output file, you may use that output file without restriction. +# This special exception was added by Craig Small in version 0.37 of dh-make. # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 -C_ARGS = -Wall -g -ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) - C_ARGS += -O0 -else - C_ARGS += -O2 -endif - -configure: configure-stamp -configure-stamp: - dh_testdir - # Add here commands to configure the package. - - touch configure-stamp - -build: build-stamp - -build-stamp: configure-stamp - dh_testdir - - # Add here commands to compile the package. - $(MAKE) C_ARGS="$(C_ARGS)" - - touch build-stamp - -clean: - dh_testdir - dh_testroot - rm -f build-stamp configure-stamp - - # Add here commands to clean up after the build process. - -$(MAKE) clean - - dh_clean - -install: build - dh_testdir - dh_testroot - dh_clean -k - dh_installdirs - - # Add here commands to install the package into debian/restartd. - $(MAKE) install DESTDIR=$(CURDIR)/debian/restartd - -# Build architecture-independent files here. -binary-indep: build install -# We have nothing to do by default. - -# Build architecture-dependent files here. -binary-arch: build install - dh_testdir - dh_testroot -# dh_installdebconf - dh_installdocs -# dh_installexamples -# dh_installmenu -# dh_installlogrotate -# dh_installemacsen -# dh_installpam -# dh_installmime - dh_installinit --init-script=restartd -# dh_installcron -# dh_installman -# dh_installinfo -# dh_undocumented - dh_installchangelogs - dh_link - dh_strip - dh_compress - dh_fixperms -# dh_makeshlibs - dh_installdeb -# dh_perl - dh_shlibdeps - dh_gencontrol - dh_md5sums - dh_builddeb - -binary: binary-indep binary-arch -.PHONY: build clean binary-indep binary-arch binary install configure +%: + dh $@ diff -Nru restartd-0.2.2/debian/source/format restartd-0.2.3/debian/source/format --- restartd-0.2.2/debian/source/format 1970-01-01 00:00:00.000000000 +0000 +++ restartd-0.2.3/debian/source/format 2013-01-13 11:48:15.616511771 +0000 @@ -0,0 +1 @@ +3.0 (quilt) diff -Nru restartd-0.2.2/debian/watch restartd-0.2.3/debian/watch --- restartd-0.2.2/debian/watch 1970-01-01 00:00:00.000000000 +0000 +++ restartd-0.2.3/debian/watch 2013-01-13 02:52:37.000000000 +0000 @@ -0,0 +1,2 @@ +version=3 +https://github.com/ajraymond/restartd/tags .*/v(\d[\d\.]+)\.tar\.gz diff -Nru restartd-0.2.2/main.c restartd-0.2.3/main.c --- restartd-0.2.2/main.c 2006-09-14 17:38:36.000000000 +0000 +++ restartd-0.2.3/main.c 2013-01-13 02:27:23.000000000 +0000 @@ -36,287 +36,244 @@ #include "config.h" // SIGTERM & SIGHUP handler -void -got_signal (int sig) +void got_signal(int sig) { - - if (sig == SIGTERM) - { - syslog (LOG_INFO, "Got SIGTERM. Exiting."); - unlink ("/var/run/restartd.pid"); - exit (0); + if (sig == SIGTERM) { + syslog(LOG_INFO, "Got SIGTERM. Exiting."); + unlink("/var/run/restartd.pid"); + exit(0); } - if (sig == SIGHUP) - { - syslog (LOG_INFO, "Got SIGHUP. Reloading config file."); - read_config (); - syslog (LOG_INFO, - "Config file has been read. Found %d process to check.", - config_process_number); + if (sig == SIGHUP) { + syslog(LOG_INFO, "Got SIGHUP. Reloading config file."); + read_config(); + syslog(LOG_INFO, + "Config file has been read. Found %d process to check.", + config_process_number); } - } - -int -main (int argc, char *argv[]) +int main(int argc, char *argv[]) { - - DIR *procdir_id; - struct dirent *procdir_dirent; - int proc_cmdline; - char *proc_cmdline_str; - ssize_t proc_cmdline_str_length; - char *proc_cmdline_name; - int i, f; - FILE *out_proc; - regex_t *regc; - size_t r_nmatch = 0; - regmatch_t r_match[256]; - pid_t child; - time_t now; - - debug = 0; - check_interval = 20; - foreground = 0; - - // Options - - config_file = strdup (DEFAULT_CONFIG); - - for (i = 0; i < argc; i++) - { - - if (!strcmp (argv[i], "-c") || !strcmp (argv[i], "--config")) - config_file = strdup (argv[i + 1]); - - if (!strcmp (argv[i], "-v") || !strcmp (argv[i], "--version")) - { - printf - ("restard %s - Copyright 2000-2002 Tibor Koleszar \n" - " Copyright 2006 Aurélien GÉRÔME \n", - VERSION); - exit (0); - } - - if (!strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) - debug = 1; - - if (!strcmp (argv[i], "-f") || !strcmp (argv[i], "--foreground")) - foreground = 1; - - if (!strcmp (argv[i], "-i") || !strcmp (argv[i], "--interval")) - { - if (atoi (argv[i + 1]) > 0) - { - check_interval = atoi (argv[i + 1]); - } - else - { - fprintf (stderr, - "Error at parameter -i: %s is not an interval number\n.", - argv[i + 1]); - exit (0); - } - } - - if (!strcmp (argv[i], "-h") || !strcmp (argv[i], "--help")) - { - printf ("restartd %s - process restarter and checker daemon\n" - "Copyright 2000-2002 Tibor Koleszar \n" - "Copyright 2006 Aurélien GÉRÔME \n" - "restartd is GPL'ed software.\n" - "Parameters:\n" - " -c : config file (default is /etc/restartd.conf)\n" - " -d : set debug on (poor)\n" - " -f : run in foreground\n" - " -i : the check interval in second\n" - " -h : help\n\n", VERSION); - } - + DIR *procdir_id; + struct dirent *procdir_dirent; + int proc_cmdline; + char *proc_cmdline_str; + ssize_t proc_cmdline_str_length; + char *proc_cmdline_name; + int i, f; + FILE *out_proc; + regex_t *regc; + size_t r_nmatch = 0; + regmatch_t r_match[256]; + pid_t child; + time_t now; + + debug = 0; + check_interval = 20; + foreground = 0; + + // Options + config_file = strdup(DEFAULT_CONFIG); + + for(i = 0; i < argc; i++) { + if (!strcmp(argv[i], "-c") || !strcmp(argv[i], "--config")) { + config_file = strdup(argv[i + 1]); + } + if (!strcmp(argv[i], "-v") || !strcmp(argv[i], "--version")) { + printf("restard %s - Copyright 2000-2002 Tibor Koleszar \n" + " Copyright 2006 Aurélien GÉRÔME \n", + VERSION); + exit(0); + } + if (!strcmp(argv[i], "-d") || !strcmp(argv[i], "--debug")) { + debug = 1; + } + if (!strcmp(argv[i], "-f") || !strcmp(argv[i], "--foreground")) { + foreground = 1; + } + if (!strcmp(argv[i], "-i") || !strcmp(argv[i], "--interval")) { + if (atoi(argv[i + 1]) > 0) { + check_interval = atoi(argv[i + 1]); + } else { + fprintf(stderr, + "Error at parameter -i: %s is not an interval number\n.", + argv[i + 1]); + exit (0); + } + } + if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "--help")) { + printf("restartd %s - process restarter and checker daemon\n" + "Copyright 2000-2002 Tibor Koleszar \n" + "Copyright 2006 Aurélien GÉRÔME \n" + "restartd is GPL'ed software.\n" + "Parameters:\n" + " -c : config file (default is /etc/restartd.conf)\n" + " -d : set debug on (poor)\n" + " -f : run in foreground\n" + " -i : the check interval in second\n" + " -h : help\n\n", VERSION); + } } - config_process = malloc (sizeof (struct config_process_type) * 128); + config_process = malloc(sizeof(struct config_process_type) * 128); + + read_config(); + + syslog(LOG_INFO, "Config file has been read. Found %d process to check.", + config_process_number); + + procdir_dirent = malloc(sizeof(struct dirent)); + proc_cmdline_str = (char *) malloc(1024); + proc_cmdline_name = (char *) malloc(1024); + regc = malloc(1024); + + // Catch signals + signal(SIGTERM, got_signal); + signal(SIGHUP, got_signal); + + // Fork + if (foreground == 1 || !(child = fork())) { + // generic daemon stuff from http://www.aarnet.edu.au/~gdt/articles/2003-09-nowhere-daemon/daemon.html + // added by cwarden@postica.com - 041216 + if (!foreground) { + if (setsid() == (pid_t) (-1)) { + fprintf(stderr, "setsid() failed\n"); + syslog(LOG_ERR, "setsid() failed"); + return -1; + } + } + + if ((chdir("/")) < 0) { + syslog(LOG_ERR, "Cannot chdir to /"); + return -1; + } + + f = open("/dev/null", O_RDONLY); + if (f == -1) { + syslog(LOG_ERR, "Failed to open /dev/null"); + return -1; + } else { + if (dup2(f, fileno(stdin)) == -1) { + syslog(LOG_ERR, "Failed to set stdin to /dev/null"); + return -1; + } + (void) close(f); + } + + f = open("/dev/null", O_WRONLY); + if (f == -1) { + syslog(LOG_ERR, "Failed to open /dev/null"); + return -1; + } else { + if (dup2(f, fileno(stdout)) == -1) { + syslog(LOG_ERR, "Failed to set stdout to /dev/null"); + return -1; + } + if (dup2(f, fileno(stderr)) == -1) { + syslog(LOG_ERR, "Failed to set stderr to /dev/null"); + return -1; + } + (void) close(f); + } + + out_proc = fopen("/var/run/restartd.pid", "wt"); + fprintf(out_proc, "%d", getpid()); + fclose(out_proc); + + while(1) { + if ((procdir_id = opendir("/proc")) == NULL) { + syslog(LOG_ERR, "Cannot open /proc dir"); + return -1; + } + + for(i = 0; i < config_process_number; i++) { + config_process[i].processes[0] = 0; + } + + while((procdir_dirent = readdir(procdir_id)) != NULL) { + if (atoi(procdir_dirent->d_name) > 0) { + sprintf(proc_cmdline_name, "/proc/%s/cmdline", + procdir_dirent->d_name); + proc_cmdline = open(proc_cmdline_name, O_RDONLY); + + proc_cmdline_str_length = + read(proc_cmdline, proc_cmdline_str, 1024); + + for(i = 0; i < proc_cmdline_str_length; i++) { + if (!proc_cmdline_str[i]) { + proc_cmdline_str[i] = 32; + } + } + + proc_cmdline_str[proc_cmdline_str_length] = 0; + + // Check process + for(i=0; id_name); + } + regfree(regc); + } + + close(proc_cmdline); + } + } + + closedir(procdir_id); + + now = time(NULL); + + out_proc = fopen("/var/run/restartd", "wt"); + + fprintf(out_proc, "%s\n", ctime(&now)); + + for(i=0; i 0) { + if (strlen(config_process[i].running) > 0) { + strcpy(config_process[i].status, "running"); + syslog(LOG_INFO, "%s is running, executing '%s'", + config_process[i].name, + config_process[i].running); + system(config_process[i].running); + } else { + strcpy(config_process[i].status, "running"); + } + } + + if (strlen(config_process[i].processes) == 0 + && strlen(config_process[i].not_running) > 0) { + strcpy(config_process[i].status, "restarting"); + syslog(LOG_ERR, "%s is NOT running, executing '%s'", + config_process[i].name, + config_process[i].not_running); + system(config_process[i].not_running); + } + + if (strlen(config_process[i].processes) == 0 + && strlen(config_process[i].not_running) == 0) { + strcpy(config_process[i].status, "not running"); + } + + fprintf(out_proc, "%-12s %-12s %s\n", + config_process[i].name, config_process[i].status, + config_process[i].processes); + } - read_config (); + fclose(out_proc); - syslog (LOG_INFO, "Config file has been read. Found %d process to check.", - config_process_number); - - procdir_dirent = malloc (sizeof (struct dirent)); - proc_cmdline_str = (char *) malloc (1024); - proc_cmdline_name = (char *) malloc (1024); - regc = malloc (1024); - - // Catch signals - signal (SIGTERM, got_signal); - signal (SIGHUP, got_signal); - - // Fork - if (foreground == 1 || !(child = fork ())) - { - - // generic daemon stuff from http://www.aarnet.edu.au/~gdt/articles/2003-09-nowhere-daemon/daemon.html - // added by cwarden@postica.com - 041216 - if (!foreground) - { - if (setsid () == (pid_t) (-1)) - { - fprintf (stderr, "setsid() failed\n"); - syslog (LOG_ERR, "setsid() failed"); - return -1; - } - } - if ((chdir ("/")) < 0) - { - syslog (LOG_ERR, "Cannot chdir to /"); - return -1; - } - f = open ("/dev/null", O_RDONLY); - if (f == -1) - { - syslog (LOG_ERR, "Failed to open /dev/null"); - return -1; - } - else - { - if (dup2 (f, fileno (stdin)) == -1) - { - syslog (LOG_ERR, "Failed to set stdin to /dev/null"); - return -1; - } - (void) close (f); - } - - f = open ("/dev/null", O_WRONLY); - if (f == -1) - { - syslog (LOG_ERR, "Failed to open /dev/null"); - return -1; - } - else - { - if (dup2 (f, fileno (stdout)) == -1) - { - syslog (LOG_ERR, "Failed to set stdout to /dev/null"); - return -1; - } - if (dup2 (f, fileno (stderr)) == -1) - { - syslog (LOG_ERR, "Failed to set stderr to /dev/null"); - return -1; - } - (void) close (f); - } - - out_proc = fopen ("/var/run/restartd.pid", "wt"); - fprintf (out_proc, "%d", getpid ()); - fclose (out_proc); - - while (1) - { - - if ((procdir_id = opendir ("/proc")) == NULL) - { - syslog (LOG_ERR, "Cannot open /proc dir"); - return -1; - } - - for (i = 0; i < config_process_number; i++) - config_process[i].processes[0] = 0; - - while ((procdir_dirent = readdir (procdir_id)) != NULL) - - if (atoi (procdir_dirent->d_name) > 0) - { - - sprintf (proc_cmdline_name, "/proc/%s/cmdline", - procdir_dirent->d_name); - proc_cmdline = open (proc_cmdline_name, O_RDONLY); - - proc_cmdline_str_length = - read (proc_cmdline, proc_cmdline_str, 1024); - - for (i = 0; i < proc_cmdline_str_length; i++) - if (!proc_cmdline_str[i]) - proc_cmdline_str[i] = 32; - - proc_cmdline_str[proc_cmdline_str_length] = 0; - - // Check process - for (i = 0; i < config_process_number; i++) - { - regcomp (regc, config_process[i].regexp, REG_EXTENDED - || REG_ICASE); - if (!regexec - (regc, proc_cmdline_str, r_nmatch, r_match, 0)) - sprintf (config_process[i].processes, "%s %s", - config_process[i].processes, - procdir_dirent->d_name); - regfree (regc); - } - - close (proc_cmdline); - - } - - closedir (procdir_id); - - now = time (NULL); - - out_proc = fopen ("/var/run/restartd", "wt"); - - fprintf (out_proc, "%s\n", ctime (&now)); - for (i = 0; i < config_process_number; i++) - { - - if (strlen (config_process[i].processes) > 0) - { - if (strlen (config_process[i].running) > 0) - { - strcpy (config_process[i].status, "running"); - syslog (LOG_INFO, "%s is running, executing '%s'", - config_process[i].name, - config_process[i].running); - system (config_process[i].running); - } - else - { - strcpy (config_process[i].status, "running"); - } - } - - if (strlen (config_process[i].processes) == 0 - && strlen (config_process[i].not_running) > 0) - { - strcpy (config_process[i].status, "restarting"); - syslog (LOG_ERR, "%s is NOT running, executing '%s'", - config_process[i].name, - config_process[i].not_running); - system (config_process[i].not_running); - } - - if (strlen (config_process[i].processes) == 0 - && strlen (config_process[i].not_running) == 0) - strcpy (config_process[i].status, "not running"); - - fprintf (out_proc, "%-12s %-12s %s\n", - config_process[i].name, config_process[i].status, - config_process[i].processes); - } - - fclose (out_proc); - - sleep (check_interval); - - } + sleep(check_interval); + } } - free (procdir_dirent); - free (proc_cmdline_str); - free (proc_cmdline_name); - free (config_process); - free (regc); - return 0; + free(procdir_dirent); + free(proc_cmdline_str); + free(proc_cmdline_name); + free(config_process); + free(regc); + return 0; } + diff -Nru restartd-0.2.2/version restartd-0.2.3/version --- restartd-0.2.2/version 1970-01-01 00:00:00.000000000 +0000 +++ restartd-0.2.3/version 2013-01-13 02:27:23.000000000 +0000 @@ -0,0 +1 @@ +0.2.3