Hot answers tagged

5

You've run into a well-known limitation with cron. The question has been asked and answered here many times. This recent example highlights the two (at least two) choices you have: use cron (older, simpler) use systemd (newer, more complex) The answer to your question in the context of cron usage is this: If your script runs from the command line, but ...


4

The following answer addresses a Hardware and Software approach, and an Easier alternative requiring only hardware & a configuration change. This project may be of interest. The author uses a simple bash script to read the RPi CPU temperature, and turn a cooling fan on and off based on the temperature. In other words, the fan only runs when the CPU ...


3

execute my bash script in order to invoke a program (e.g. open an instance of LXTerminal If your auto-started program needs anything graphical, then you're trying the wrong thing. Try putting it in the lxsession-autostart: sudo mousepad /etc/xdg/lxsession/LXDE-pi/autostart Add your command to the bottom of the file, then save and exit.


2

You would need a way of switching the 5V supply on and off. The Pi GPIO are all 3V3 and can not supply enough power for a fan. The 5V pins are NOT GPIO and are not switchable (they are powered while the Pi is powered). Search for relays, transistors, MOSFETs, etc. to use as a switch.


2

The pijuice library GetStatus() function should give you what you need: https://github.com/PiSupply/PiJuice/blob/master/Software/README.md#pijuice-status GetStatus() Gets basic PiJuice status information about power inputs, battery and events. Returns: {'data':{ 'isFault':is_fault, 'isButton':is_button, 'battery':battery_status, 'powerInput':...


2

I think there are many ways to do this. Perhaps the "most correct" way is to daemonize the app. There's an answer on Stack Overflow that provides some suggestions. You could do that yourself, or perhaps consider submitting that request to the author via creating a new issue on his GitHub page. Until that happens: Have you tried just running it in ...


1

A basic way to do this would be to use screen or tmux. Closing the ssh session closes the active terminal but does not end the screen session, and you can later reattach using screen -x or tmux attach. If you want to get more serious about things you could write a simple systemd service to start the script at boot and keep it running in the background. You'd ...


1

PJSIP is definitely what you need. Tell something more about what exactly your problem is. Example below shows simple application based on PJSUA (high level API of PJSIP). #include <pjsua-lib/pjsua.h> #include <iostream> #define THIS_FILE "sipdtmf.cpp" using namespace std; void on_incoming_call(pjsua_acc_id acc_id, pjsua_call_id ...


1

Your question isn't clear to me, but I guess you are asking about the ssh client instead of the ssh server/sshd. If so, you may find help in reviewing the ssh client parameters in /etc/ssh/ssh_config. There is no sleep mode in RPi. If that doesn't help, please try to add details to your question that provide clues we can use.


1

You could do something as simple as ping -q -c 1 -W 1 8.8.8.8 >/dev/null and check the return code in a script. If your provider doesn't let ICMP through, you might want to make an HTTP request and check the response code like described here: case "$(curl -s --max-time 2 -I http://google.com | sed 's/^[^ ]* *\([0-9]\).*/\1/; 1q')" in [23]) ...


1

I made it work! :) I'm no Linux expert and I made plenty of tests (trial & errors) so here are some notes that might help the next person who has this problem: The app I was needing the grpc for is built in .Net Core 3.1 and was deployed/debugged remotely via ssh from Windows 10 (using Visual Studio 2019). I built the grpc "v1.34.0-pre1" ...


1

As in Joan's answer you need a switch HOWEVER you DO NOT need any software; the Raspberry Pi OS kernel includes code to control a fan - only a single line in config.sys is required. SeeFan Control


1

Create a folder on your exFAT drive and write logs to that folder. That way, when the drive is not mounted, the folder will not exist and thus no files could be created in it. A similar effect could be achieved with permissions: forbid the user running the script to create files in the mount point. When the drive is mounted, the mount point will be hidden ...


1

You need to fix all those wonky quote marks in your code. When I recoded your program as #!/bin/bash # Add ricnumber. riclist=( '428824' '408888' ) while IFS='' read -r line do printf -v filename "rtj`date +%Y_%m_%d`.log" echo "`date +%T` $line" >> $filename count=0 while [ "${riclist[count]}" != "&...


1

Rather that starting and stopping the Python script for every picture, you really want a long running Python program, probably set up as a Linux service that autostarts at boot time, that monitors the gpio pins your buttons are attached to with interrupts that trigger functions in your program to do exactly what you want.


1

It would be possible to write a bash script but inefficient and poor practice. Especially as you are using python just install gpiozero and use one (or several ) of the Button callbacks in your python script.


1

What I've got is a script that runs every three minutes using a line in crontab */3 * * * * /home/dougie/dnso.sh This ugly bash script gets my public IP address using the OpenDNS service then drives the No-IP updater. It logs every IP address when it changes (I've got a record of 303 addresses since 8th Jan 2015). You'd need to kickstart it with echo "192....


1

Lines like the one below in your error log are giving you a hint: [Sat Jun 24 12:00:53.928111 2017] [cgid:error] [pid 2640:tid 1945105456] [client ::1:54506] End of script output before headers: Testled2.py /usr/bin/env: python3: No such file or directory By saying python3: No such file or directory, they mean that either the first line of your scripts is ...


Only top voted, non community-wiki answers of a minimum length are eligible