diff options
| author | Paul Buetow <paul@buetow.org> | 2023-05-05 00:20:45 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2023-05-05 00:20:45 +0300 |
| commit | d672f3b16f5e872da764dab2ba1e76517be2b46a (patch) | |
| tree | 57a3804fe724aaca3ac10f8fec08504927938290 | |
| parent | 7f99989467ff8140b7420806379d806d9055a89a (diff) | |
add habit server
| -rw-r--r-- | frontends/Rexfile | 17 | ||||
| -rw-r--r-- | frontends/etc/gogios.json.tpl | 2 | ||||
| -rw-r--r-- | frontends/etc/inetd.conf | 1 | ||||
| -rw-r--r-- | frontends/etc/login.conf.d/inetd | 3 | ||||
| -rw-r--r-- | frontends/scripts/habit.pl | 36 |
5 files changed, 58 insertions, 1 deletions
diff --git a/frontends/Rexfile b/frontends/Rexfile index 6fdfcf6..967d031 100644 --- a/frontends/Rexfile +++ b/frontends/Rexfile @@ -92,9 +92,11 @@ task 'dump_info', group => 'frontends', sub { dump_system_information }; desc 'Install base stuff'; task 'base', group => 'frontends', sub { + pkg 'figlet', ensure => present; pkg 'tig', ensure => present; pkg 'vger', ensure => present; pkg 'zsh', ensure => present; + pkg 'bash', ensure => present; my @pkg_scripts = qw/uptimed httpd dserver icinga2/; push @pkg_scripts, 'znc' if connection->server eq $ircbouncer_server; @@ -212,6 +214,12 @@ task 'inetd', group => 'frontends', sub { append_if_no_such_line '/etc/rc.conf.local', 'inetd_flags='; + file '/etc/login.conf.d/inetd', + source => './etc/login.conf.d/inetd', + owner => 'root', + group => 'wheel', + mode => '644'; + file '/etc/inetd.conf', source => './etc/inetd.conf', owner => 'root', @@ -220,6 +228,15 @@ task 'inetd', group => 'frontends', on_change => sub { service 'inetd' => 'restart' }; service 'inetd', ensure => 'started'; + + pkg 'cowsay', ensure => present; + run 'adduser -class inetd -group _habit -batch _habit', unless => 'id _habit'; + + file '/usr/local/bin/habit.pl', + source => './scripts/habit.pl', + owner => 'root', + group => 'wheel', + mode => '755'; }; desc 'Setup relayd'; diff --git a/frontends/etc/gogios.json.tpl b/frontends/etc/gogios.json.tpl index 7802a20..80394b0 100644 --- a/frontends/etc/gogios.json.tpl +++ b/frontends/etc/gogios.json.tpl @@ -74,7 +74,7 @@ }, <% } -%> <% } -%> - <% for my $nrpe_check (qw(load users disk zombie_procs total_procs backup_wallabag backup_nextcloud backup_anki)) { %> + <% for my $nrpe_check (qw(load users disk zombie_procs total_procs backup_wallabag backup_nextcloud backup_anki backup_tidal backup_protonmail backup_codeberg)) { %> "Check NRPE <%= $nrpe_check %> babylon5.buetow.org": { "Plugin": "<%= $plugin_dir %>/check_nrpe", "Args": ["-H", "babylon5.buetow.org", "-c", "check_<%= $nrpe_check %>", "-p", "5666", "-4"], diff --git a/frontends/etc/inetd.conf b/frontends/etc/inetd.conf index 7467a43..22eae50 100644 --- a/frontends/etc/inetd.conf +++ b/frontends/etc/inetd.conf @@ -1,3 +1,4 @@ 127.0.0.1:11965 stream tcp nowait www /usr/local/bin/vger vger -v rsync stream tcp nowait root /usr/local/bin/rsync rsyncd --daemon +*:1234 stream tcp nowait _habit /usr/bin/perl perl -T /usr/local/bin/habit.pl # *:4242 stream tcp nowait _failunderd /bin/cat cat /var/run/failunderd/status.json diff --git a/frontends/etc/login.conf.d/inetd b/frontends/etc/login.conf.d/inetd new file mode 100644 index 0000000..c8620c4 --- /dev/null +++ b/frontends/etc/login.conf.d/inetd @@ -0,0 +1,3 @@ +inetd:\ + :maxproc=10:\ + :tc=daemon: diff --git a/frontends/scripts/habit.pl b/frontends/scripts/habit.pl new file mode 100644 index 0000000..72305d3 --- /dev/null +++ b/frontends/scripts/habit.pl @@ -0,0 +1,36 @@ +#!/usr/bin/perl -T + +use v5.36; +use strict; +use warnings; + +use Acme::Cow; + +our @habits = ( + 'Do Push-ups', + 'Do Yoga Wheel', + 'Do Yoga Cro', + 'Do Yoga Downward Facing Dog', + 'Do Yoga Warrior 3', + 'Do Yoga Half Moon', + 'Do Shoulder stand', + 'Meditate', + 'Listen to music', + 'Do nothing', + 'Breathing exercise', + 'Play with the cat', + 'Drink water', + 'Think about the purpose of what I am doing', + 'Write down 3 things I am grateful for', + 'Take it easy - nobody is dying!', + 'Enjoy my current task', + 'It\'s family time', + 'Help someone', + 'Learn/try out a new Linux/Unix command', +); + +my $habit = $habits[rand @habits]; +my $cow = Acme::Cow->new; +$cow->text($habit); +int(rand 2) ? $cow->say : $cow->think; +$cow->print; |
