Hot answers tagged

40 votes

Execute script on start-up

Add it to the crontab The crontab runs commands at defined times. Edit the file: sudo crontab -e Add line to file (here a python script): @reboot python3 /home/pi/Desktop/exemple.py &
Aaron's user avatar
  • 549
33 votes
Accepted

Setting timezone non-interactively

use timedatectl - for example sudo timedatectl set-timezone Australia/Sydney
Jaromanda X's user avatar
  • 2,383
16 votes

Execute script on start-up

Autostarting xorg apps If the script you want to start requires an xorg session then you might try following the freedesktop autostart spec which might or might not work depending on which desktop ...
ccpizza's user avatar
  • 431
16 votes

How do I know what version of Python script I'm writing?

how do I know what version of Python (2 or 3) I'm writing for Well, you should know because it is ultimately your decision! You pick one, you use the syntax of that particular generation, and you ...
Ghanima's user avatar
  • 15.8k
11 votes

Running multiple scripts from different languages

You can run any number of scripts with varying programming language. You can think in the direction of using tools like Screen or tmux. They basically are used to run scripts in background or detached ...
Shan-Desai's user avatar
  • 1,511
11 votes
Accepted

Running multiple scripts from different languages

Assuming that you're not running a weird custom operating system with a minimal kernel, the RPi is running a full fledged version of linux. The applications it comes with are written in C, C++, Java, ...
Jacobm001's user avatar
  • 11.9k
9 votes
Accepted

Clone Raspberry Pi SDCard to file on Mac OS X?

I use the following script to backup SD cards on OS X:- #!/bin/bash # script to backup Pi SD card # 2017-06-05 # 2018-11-29 optional name # DSK='disk4' # manual set disk OUTDIR=~/temp/Pi # Find ...
Milliways's user avatar
  • 58.6k
9 votes
Accepted

Log output of background or boot script

First, if the script is run by a system daemon and that daemon is running with root privileges, you do not need to use sudo. This includes init (and systemd), which includes rc.local. If that daemon ...
goldilocks's user avatar
  • 58.5k
8 votes

Execute script on start-up

I want to throw in my two cents, even though this is an old question but commonly asked to do simple thing - autostart. I tried all the suggested solutions in all the answers for this question. NONE ...
ThN's user avatar
  • 1,015
7 votes

Running multiple scripts from different languages

I second Shan-Desai's suggestion of tmux, which is great, but perhaps this is actually overkill for your application. If neither of the scripts is in some way interactive, requires user input etc., ...
leftaroundabout's user avatar
7 votes

Run a script at shutdown on Raspbian

If you are using systemd, just put your script to /lib/systemd/system-shutdown/ as described here and here. EDIT: If it's not working try this one: Create a systemd service: /etc/systemd/system/...
jake's user avatar
  • 1,339
6 votes

Execute script on start-up

NEW METHOD - RASPBERRY PI OS. This should work on other versions too. Create a desktop file xyz.desktop type the following into it [Desktop Entry] Encoding=UTF-8 Type=Application Name=<Application ...
Amr Sohil's user avatar
6 votes

Execute script on start-up

I also had trouble with this. On the Raspberry Pi3 running Raspbian this is what I did: Create a startup shell script in your root directory (I named mine "launch"): sudo leafpad launch.sh Save ...
lamarant's user avatar
  • 221
6 votes
Accepted

"bin/bash: bad interpreter: No such file or directory" when running shell script

A script is running without its interpreter when it is made executable and contains a shebang at the very first line. Because your script is running I assume that's the case with your script. But the ...
Ingo's user avatar
  • 41.9k
5 votes

How to find out the default init system of my raspbian?

Raspian is basically Debian. Debian until and including Wheezy/7 used SysV, since Jessie/8 systemd. Upstart is not relevant anymore, since even RHEL and Ubuntu (the Upstart developers) have moved ...
kba's user avatar
  • 312
5 votes

Checking if a given program is running

@SteveRobillard answered my question in the comments. I will re-iterate it here for everyone to see clearly! 1. Viewing running programs: In the terminal type: ps aux | grep programname ps = ...
Kookaburra's user avatar
5 votes

How do I know what version of Python script I'm writing?

I would probably base it on the library I need to use. I would always try to stick with Python 3 as it is the new version, but if a library I need has not been upgraded/converted, then I'll have to ...
Ricardo's user avatar
  • 1,038
5 votes

How to set up dashboard for monitoring PI processes

You could use "Munin" with Raspbian to monitor your RPis. You need only one "Munin Master" and on each device you want to monitor, the "Munin Node" software. "Munin" is very flexible and comes with ...
Fabian's user avatar
  • 1,260
5 votes
Accepted

Remote full reset (re-install) of a Raspberry

Firstly: doing this by remote is inadvisable especially if, like me, you happen to be 70+ miles from your remote pi. It's a very long drive if you screw it up. When you do this fir the first time, ...
Philip Couling's user avatar
5 votes

Monitoring NICs on the Pi

On Linux systems, there's a special file at /sys/class/net/$interface/carrier (where $interface is your interface name, e.g., eth0, wlan0). You can read from it like you would any other file in Python....
Brooke Chalmers's user avatar
5 votes
Accepted

Can't run python script on startup. Raspberry Pi 4

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, ...
Seamus's user avatar
  • 21.1k
4 votes

Execute script on start-up

Method 1: To launch a command automatically on login, put the command into a file named .bashrc in the user directory (for example /home/pi) .bashrc is NOT intended to run scripts. It is ...
User98764431's user avatar
4 votes

Clone Raspberry Pi SDCard to file on Mac OS X?

You can use dd to backup the drive. The trick is to use the device as the input, not its partitions. Taking an example from the RPi forum, you can backup and even auto compress the information in one ...
Jacobm001's user avatar
  • 11.9k
4 votes

Autorun Firefox on startup...grrrrrrr!

Ok I am giving a shot at this, try following the mentioned steps (type in your Terminal): create a folder called 'lxsession' in your hidden folder called .config: $ mkdir /home/pi/.config/lxsession ...
Shan-Desai's user avatar
  • 1,511
4 votes

Check system name and kernel version in script

Here's something which takes a different twist on /etc/os-release, which has a standardized format based around setting shell variables, meaning you can source it and use them. First have a look at ...
goldilocks's user avatar
  • 58.5k
4 votes
Accepted

How can I make AutoHotkey script work on Raspberry / alternative?

AutoHotKey is a windows scripting language. You cannot run it natively on a Linux operating system. It is technically possible to run it through WINE, but that hardly seems worth the effort, in my ...
Jacobm001's user avatar
  • 11.9k
4 votes

Running multiple scripts from different languages

No, there are no obvious reasons why you wouldn't be able to run two scripts in two languages at the same time. The Pi's just a very wee, relatively low-powered Linux machine and is perfectly capable ...
goobering's user avatar
  • 10.7k
4 votes

Visualize execution of scripts

Redirect output and errors to a file: myscript.sh >> /home/pi/log.txt 2>&1 &
CoderMike's user avatar
  • 6,827
4 votes

Include File With Raspbian Setup

Welcome, Lucas. I'm puzzled about your time trial. I don't see how you can put NOOBS on the micro SD card without copying... My advice would be to get a Pi built with the exact config you want (...
Jonathan's user avatar
  • 354
4 votes

My script in autostart not work correctly

ANSWER # 1: In looking at your script, I see a potential issue in the use of sudo. You may get away with this in Raspbian, but you won't in many other distributions (distros). This is due to the fact ...
Seamus's user avatar
  • 21.1k

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