1
0
Fork 0
mirror of https://github.com/pygos/init.git synced 2024-11-22 19:19:47 +01:00
Commit graph

113 commits

Author SHA1 Message Date
David Oberhollenzer
b9ba11b4db Add service commands to manage gcrond services
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-09-19 12:22:14 +02:00
David Oberhollenzer
f38163772c Add simple cron implementation
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-09-19 12:22:14 +02:00
David Oberhollenzer
5cd5f48f76 Add helper library for cron configuration
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-09-17 14:53:19 +02:00
David Oberhollenzer
481744a2ba Move splitkv function to libcfg
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-09-16 01:12:06 +02:00
David Oberhollenzer
5b78d4d695 Add an optional service for switching the console font
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-09-12 18:44:29 +02:00
David Oberhollenzer
ce7c79a639 Release init-0.6 2018-09-01 17:46:14 +02:00
David Oberhollenzer
f67d32cba1 Silence some services that like to write to the console
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-09-01 17:39:22 +02:00
David Oberhollenzer
42fba964c9 Centralize/unify version string printing
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-09-01 17:22:24 +02:00
David Oberhollenzer
3b8764b9d2 usyslogd: fix getopt arguments
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-09-01 16:40:14 +02:00
David Oberhollenzer
dc30dd7530 Add tiny klogd implementation
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-09-01 13:03:18 +02:00
David Oberhollenzer
b0b6c68e38 Only enable signals in signalfd that initd actually handles
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-09-01 00:00:40 +02:00
David Oberhollenzer
bb16d1f1bf Add service files for OpenSSH server
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-08-31 22:39:58 +02:00
David Oberhollenzer
f39aba8aa3 Add man page for service command
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-08-31 17:54:23 +02:00
David Oberhollenzer
34aff498ed Add man page for syslog command
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-08-31 10:14:06 +02:00
David Oberhollenzer
b5c6e9d392 Add man page stub for shutdown
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-08-28 20:55:27 +02:00
David Oberhollenzer
0ed964c8a5 Cleanup and update documentation
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-08-28 14:25:28 +02:00
David Oberhollenzer
066efaa33e initd: automatically do a shutdown/reboot when the target is completed
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-08-24 21:17:31 +02:00
David Oberhollenzer
2d54b32d24 Cleanup shutdown command, make reboot a symlink to shutdown
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-08-24 21:17:31 +02:00
David Oberhollenzer
ec6264bad5 initd: accept sigterm and simply initiate shutdown target
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-08-24 21:17:31 +02:00
David Oberhollenzer
25afc0b3d0 Remove ctrl+alt+del target, simply initiate reboot target
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-08-24 21:17:31 +02:00
David Oberhollenzer
ec74e5bbee initd: restructure and merge service supervision code
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-08-24 21:17:31 +02:00
David Oberhollenzer
532f5e6819 Normalize syslog message line endings
Most syslog messages have a line feed at the end, but some don't. This patch
removes trailing spaces from all syslog messages that have one and always adds
a line feed in the logging back end.

Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-08-23 09:07:10 +02:00
David Oberhollenzer
73404a09d4 usyslogd: minor header restructuring/file structure cleanup
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-08-20 12:31:51 +02:00
David Oberhollenzer
325f919847 usyslogd: chroot into log dir and drop privileges
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-08-20 07:44:15 +02:00
David Oberhollenzer
61bc850984 usyslogd: merge log files for the same service
If a service provides an identifier string, write all messages for that
service itno a file named after that identifier instread of splitting it
up by facility ID in a sub directory.

This is supposed to cleanup and simplify the clutter created in /var/log.

Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-08-20 07:44:15 +02:00
David Oberhollenzer
f51dca0878 usyslogd: report error if file operation fails
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-08-19 10:14:19 +02:00
David Oberhollenzer
5509e77a1c Release init-0.5 2018-08-16 22:52:27 +02:00
David Oberhollenzer
e7121bf467 usyslogd: at least create files/sockets relative to prefix path
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-08-16 22:48:55 +02:00
David Oberhollenzer
29e4fc5607 usyslogd: more control over log rotate behaviour, command line processing
- Add more fine grained control over how log rotation is supposed to behave
 - Add command line option processing to usyslogd
 - Expose log rotation control via command line switches
 - Add default values to usyslogd service for pygos use case

Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-08-16 22:48:55 +02:00
David Oberhollenzer
21b88d9352 usyslogd: keep track of log file size
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-08-16 18:20:27 +02:00
David Oberhollenzer
d62ee95689 Implement simple log rotation
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-08-16 13:59:02 +02:00
David Oberhollenzer
4311b9a2f1 usyslogd: create abstraction for log stream management
This commit seperates the formating and printing of log messages to files
more cleanly from the message pump that retrieves the log messages.

At a later point, other backends could be added more easiyl (e.g. forward
the log message to some server).

Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-08-16 13:31:13 +02:00
David Oberhollenzer
0624f95de6 usyslogd: cleanup log file filename handling
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-08-13 22:06:34 +02:00
David Oberhollenzer
e15208097c Add nftables service
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-07-23 20:20:27 +02:00
David Oberhollenzer
95d8ddd713 Clean up service list short listing format
We already print the services in dependency order, for each target
individually. There is no need to print the depencies and the target
for each service.

In addtion, printing name and description in one line shortens the
resulting list.

Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-07-23 09:28:02 +02:00
David Oberhollenzer
c3249ae0c9 Add swclock service for systems without a hardware RTC
Some systems don't have a hardware real time clock and don't know the time
after bootin. An obvious soulution for this is to use time from an ntp
server. Unfortunately that requires domain name resolution, which resolvers
like unbound won't do for us, if the DNSSEC certificates aren't valid, which
they aren't if we start out with a time around 1970-1-1.

The "software clock" service tries to provide a workaround by restoring a
reasonably valid time from a backup file during boot, which we update when
shuting down. If we wan't a more correct time, we have to update it from
NTP in between.

Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-07-22 21:38:14 +02:00
David Oberhollenzer
056d3c8e64 Add output truncation flag
This commit adds a "truncate" flag that can be added to a service
description between the "tty" keyword and the path string.

If the flag is set, the output file is truncated to 0 after opening.

This probably requires some remodeling in the future as the tty keyword
no longer deals with just tty devices.

Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-07-22 17:57:20 +02:00
David Oberhollenzer
8718c31928 Add service file for hostapd
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-07-20 20:58:34 +02:00
David Oberhollenzer
f9d75896f4 Cleanup service dependencies
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-07-18 21:33:25 +02:00
David Oberhollenzer
4b047ad61e Add a module auto loading service
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-07-18 17:56:09 +02:00
David Oberhollenzer
258848ace2 Add ifdown service
Add a service file and helper script to shut down all network interfaces
during shutdown or reboot.

Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-07-17 18:02:46 +02:00
David Oberhollenzer
7097830f8f Release init-0.4 2018-06-17 20:18:32 +02:00
David Oberhollenzer
9878e69ebe usyslogd: store logs in subdirectory based on service identifier
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-06-17 18:20:53 +02:00
David Oberhollenzer
8a8f49a501 usyslogd: do logfile lookup by facility number
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-06-17 16:27:26 +02:00
David Oberhollenzer
f1cc12f55e [usyslogd] split off syslog parsing
- Add proto.{h,c} for parsing of syslog message
 - Also parse time stamp in addition to priority

Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-06-11 19:47:52 +02:00
David Oberhollenzer
d9f883f215 Add utility for producing syslog message from the shell
This can can be used by shell scripts to produce syslog messages,
as well as aiding in debugging the usyslogd daemon.

Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-06-11 19:45:42 +02:00
David Oberhollenzer
f52c7ea9d0 Add minimalistic syslog daemon
For now this daemon simply dumps all syslog messages into seperate log
files and doesn't do much parsing. Since the messages are readable ASCII
anyway, this should not be to much of a problem and sufficient for
debugging.

Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-06-11 19:45:42 +02:00
David Oberhollenzer
ed23d075ca Make mksock() more generic, move to util library
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-06-09 15:32:29 +02:00
David Oberhollenzer
bf63f78b66 Split configuration parser and utility library
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-06-09 15:32:29 +02:00
David Oberhollenzer
1eb8a4c792 Add service file for dnsmasq
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-06-09 15:32:29 +02:00