1
0
Fork 0
mirror of https://github.com/pygos/init.git synced 2024-11-16 16:57:09 +01:00
Commit graph

175 commits

Author SHA1 Message Date
David Oberhollenzer
b3773d09ea Only parse arguments if index actually is numeric
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-11-03 19:26:00 +01:00
David Oberhollenzer
24e98f1e5b Fix parameter substitution escape of '%'
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-10-20 17:41:22 +02:00
David Oberhollenzer
ef51a8e06f Silence nginx service
Make sure it *only* prints to its log files and doesn't spam all
over the TTY if it cannot find the favicon that $BROWSER requested.

Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-10-20 16:36:12 +02:00
David Oberhollenzer
53bc182e09 Fix argv_exec allocation size of argument vector
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-10-16 23:06:58 +02:00
David Oberhollenzer
24c90b7700 Configuration parser cleanup
- Do a getline() & process in rdline instead of doing a read per character
   and feeding it through a state machine.
 - Move splitkv to rdcfg.c, the only place where it is used

Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-10-10 16:45:11 +02:00
David Oberhollenzer
7b647eefef Release init-0.7 2018-10-07 02:10:17 +02:00
David Oberhollenzer
209121cdeb Add nginx service
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-10-07 02:10:17 +02:00
David Oberhollenzer
e171f88865 Remove pid fron cron serives, reap children in signal handler
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-09-21 18:08:48 +02:00
David Oberhollenzer
a191a7cc18 Fix gitignore service exclusion
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-09-21 14:40:52 +02:00
David Oberhollenzer
66dde441bc Add helper script to update the time from NTP
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-09-21 12:41:42 +02:00
David Oberhollenzer
33aa4cedff Update documentation
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-09-19 12:22:14 +02:00
David Oberhollenzer
a4dddb7777 Add cron job for swclocksave
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-09-19 12:22:14 +02:00
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