Reddit refuge, escentric engineer and serial hobbyist.

  • 2 Posts
  • 18 Comments
Joined 1 year ago
cake
Cake day: June 10th, 2023

help-circle


  • czardestructo@lemmy.worldtoSelfhosted@lemmy.worldNextcloud appreciation post
    link
    fedilink
    English
    arrow-up
    4
    arrow-down
    1
    ·
    2 months ago

    I understand that everyone doesn’t always have a perfect experience but I’ve been using the same instance of nextcloud for over 8 years I just keep upgrading and migrating. It just works. Only issues I’ve had is when Debian withholds updating php for too long or when they finally do all the config files for php get fucked and I have to redo them all.







  • I’m going to have to give this a shot tonight, need to make a pfsense rule to allow the server to get out and then change its DNS. Regarding php, my current config is the following because I have over 64gigs of ram and went through great length to get Nextcloud to cache MORE into ram:

    pm.max_requests = 50000 #set higher, the process is recyled after 50k calls to prevent memory leaks
    pm.max_children = 1000
    pm.start_servers = 60
    pm.min_spare_servers = 30
    pm.max_spare_servers = 120
    



  • Perhaps not the same but I own a 150 year old home in America and I had foam insulation blown in. The insulation it provided was minor but what it helped tremendously with was drafts and air exchange. On older homes air leaks and sealing any cracks and drafts can potentially save you more money than adding actual insulation depending on how leaky it is. Food for thought though it might not help you.






  • I’ve been running the Joplin server for over a year with clients on four laptops and three phones and share notes with my wife and its wonderful. There are certainly quirks and sometimes sync issues but by and large I’m really happy with it. There seems to be one cluster of notes I have that always irritates a fresh client sync and it shows up at 50 conflicts but I work through it. Also my notebooks are huge and the first sync can take an hour. It’s a lot slower than I’d expect.



  • Sorry, I forgot to post the scripts. I’m a meathead electrical engineer so I don’t use GIT or anything so here is the code dump. To summarize the setup’s software:

    • cron to run the script that turns the ethernet on and runs rsync to pull data from the server. I have 12 cron entries for the various months/dates/times to run.
    • python script to monitor the button presses for manually running a backup or turning the ethernet port back on
    • bash script that runs the rsync job to pull data from the primary server

    The backup script is fairly boring, just runs rsync and pushes the rsync log files back to the primary server. If it fails it sends me an email before turning the ethernet back off and going black.

    #So here is my python code that runs the button press:

    #!/usr/bin/env python
    
    import RPi.GPIO as GPIO
    import subprocess
    import time
    from multiprocessing import Process
    
    
    #when this script first runs, at boot, disable ethernet
    time.sleep(5) #wait 5 seconds for system to boot, then try and disable ethernet.
    subprocess.call(['/home/pi/ethernet_updown.sh'], shell=False)
    
    GPIO.setmode(GPIO.BCM)
    GPIO.setup(3, GPIO.IN, pull_up_down=GPIO.PUD_UP)
    GPIO.setup(22, GPIO.OUT) #controls TFT display backlight
    GPIO.setup(23, GPIO.IN) #pull up or down is optional, the TFT display buttons have a hardware 10k pull up. Measure low tranisitions 
    GPIO.setup(24, GPIO.IN)
    
    
    #watches the button mounted above the USB port, in the Pi's case. 
    def case_button_watch():
        while True:
            GPIO.wait_for_edge(3, GPIO.FALLING)
            #wait 100ms then check if its still low, debounce timer
            time.sleep(.100)
            if GPIO.input(3) == GPIO.LOW:
                #do something as it's a button press
                print('Button is pressed!')
                time.sleep(.900)
                if GPIO.input(3) == GPIO.LOW:
                    #if the button is pressed for over 1 second its a long press. Run the backup script
                    print('Button long press (greater than 1 second), running an unscheduled backup')
                    subprocess.call(['/home/pi/backup.sh'], shell=False)
                else:
                    #the press was greater than 100mS but less than 1000mS, just toggle the ethernet
                    print('Button short press (less than 1 second), toggling the ethernet')
                    subprocess.call(['/home/pi/ethernet_updown.sh'], shell=False)
            else:
                #do nothing as its interference
                print('GPIO3 debounce failed, it was noise')
    
    #watches the buttons in the TFT display 
    def TFT_display_button1():
        while True:
            GPIO.wait_for_edge(23, GPIO.FALLING)
            #wait 100ms then check if its still low, debounce timer
            time.sleep(.100)
            if GPIO.input(23) == GPIO.LOW:
                #do something as it's a button press
                print('Button GPIO23 is pressed!')
                GPIO.output(22, GPIO.HIGH) #turn the backlight ON
            else:
                #do nothing as its interference
                print('GPIO23 debounce failed, it was noise')
    
    #watches the buttons in the TFT display
    def TFT_display_button2():
        while True:
            GPIO.wait_for_edge(24, GPIO.FALLING)
            #wait 100ms then check if its still low, debounce timer
            time.sleep(.100)
            if GPIO.input(24) == GPIO.LOW:
                #do something as it's a button press
                print('Button GPIO24 is pressed!')
                GPIO.output(22, GPIO.LOW) #turn the backlight OFF
            else:
                #do nothing as its interference
                print('GPIO24 debounce failed, it was noise')
    
    if __name__ == '__main__':
    
        #run three parallel processes to watch all three buttons with software debounce
        proc1 = Process(target=case_button_watch)
        proc1.start()
    
        proc2 = Process(target=TFT_display_button1)
        proc2.start()
    
        proc3 = Process(target=TFT_display_button2)
        proc3.start()
    

    #bash script that toggles the ethernet - if its on, it turns it off. if its off, it turns it on:

    #!/bin/bash
    
    if sudo ifconfig | grep 'eth0' | grep 'RUNNING' > /dev/null; 
    then 
        wall -n "$(date +"%Y%m%d_%H%M%S"):Ethernet going down"
        sudo ifconfig eth0 down	
    else 
        wall -n "$(date +"%Y%m%d_%H%M%S"):Ethernet going up"
        sudo ifconfig eth0 up
    fi