====================================
| FreeBSD manual install - Tuptime |
====================================


Install dependencies, latest versions:

    # pkg install python3
    # pkg install py311-sqlite3  # (version number must match "python3 -V")

Get code and copy executable file:

    # fetch -o tuptime.zip https://github.com/rfmoz/tuptime/archive/refs/heads/master.zip
    # unzip tuptime.zip
    # install -m 755 tuptime-master/src/tuptime /usr/local/bin/tuptime

Add tuptime user:

    # pw adduser _tuptime -d /var/lib/tuptime -s /usr/sbin/nologin -c "Tuptime execution user"

Execute tuptime with a privileged user to create db path and change user/group:

    # tuptime
    # chown -R _tuptime:_tuptime /var/lib/tuptime

Add the cron entry, create a '/usr/local/etc/cron.d/tuptime' file with this content:

    */5 * * * * _tuptime (/usr/sbin/service tuptime enabled) && /usr/local/bin/tuptime -q

Copy rc.d file:

    # mkdir /usr/local/etc/rc.d/
    # install -m 555 tuptime-master/src/rc.d/freebsd/tuptime /usr/local/etc/rc.d/tuptime
    # sysrc tuptime_enable=YES
    # service tuptime start

It's all done.



====================================
| OpenBSD manual install - Tuptime |
====================================


Install dependencies, latest versions:

    # pkg_add wget python

If not exists yet, create python3 symlink:

    # ln -s $(ls /usr/local/bin/python3.*[0-9]) /usr/local/bin/python3

Get code and copy executable file:

    # wget -O tuptime.tar.gz https://github.com/rfmoz/tuptime/archive/refs/heads/master.tar.gz
    # tar -xzvf tuptime.tar.gz
    # install -m 755 tuptime-master/src/tuptime /usr/local/bin/tuptime

Add tuptime user:

    # useradd -s /sbin/nologin -d /var/lib/tuptime -L daemon _tuptime

Execute tuptime with a privileged user to create db path and change user/group:

    # tuptime
    # chown -R _tuptime:_tuptime /var/lib/tuptime

Add the cron entry, create a '/var/cron/tabs/_tuptime' file with this content:

    SHELL=/bin/sh
    PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin/
    */5       *       *       *       *       tuptime -q

Set the right permissions to cron file and restart the service:

    # chown _tuptime:crontab /var/cron/tabs/_tuptime 
    # chmod 600 /var/cron/tabs/_tuptime 

Copy rc.d file:

    # install -m 555 tuptime-master/src/rc.d/openbsd/tuptime /etc/rc.d/tuptime
    # rcctl enable tuptime
    # rcctl start tuptime

It's all done.



===================================
| NetBSD manual install - Tuptime |
===================================


Install dependencies:

    # PKG_PATH=http://ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/(amd64|i386|etc)/(9.4|10.0|etc)/All/
    # export PKG_PATH
    # pkg_add pkgin
    # pkgin install fetch python3?

Create a symlink for the Python3 interpreter:

    # mkdir -p /usr/local/bin/
    # ln -s /usr/pkg/bin/python3.? /usr/local/bin/python3
     
Get code and copy executable file:

    # fetch -o tuptime.zip https://github.com/rfmoz/tuptime/archive/refs/heads/master.zip
    # unzip tuptime.zip
    # install -m 755 tuptime-master/src/tuptime /usr/local/bin/tuptime

Add tuptime user/group:

    # groupadd _tuptime
    # useradd -d /var/lib/tuptime -s /sbin/nologin -g _tuptime _tuptime

Execute tuptime with a privileged user to create db path and change user/group:

    # tuptime
    # chown -R _tuptime:_tuptime /var/lib/tuptime

Add the cron entry, create a '/var/cron/tabs/_tuptime' file with this content:

    SHELL=/bin/sh
    PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin/
    */5       *       *       *       *       tuptime -q

Set the right permissions to cron file and restart the service:

    # chown _tuptime /var/cron/tabs/_tuptime 
    # chmod 600 /var/cron/tabs/_tuptime
    # service cron restart

Copy rc.d file:

    # install -m 555 tuptime-master/src/rc.d/freebsd/tuptime /etc/rc.d/tuptime
    # echo 'tuptime_enable="YES"' >> /etc/rc.conf
    # service tuptime start

It's all done.
