Go to advanced search

by DougieLawson
Sun Apr 21, 2019 7:26 pm
Forum: Beginners
Topic: Crontab and Terminal
Replies: 6
Views: 102

Re: Crontab and Terminal

You really should do that from autostart as it's an order of magnitude easier.

If you run it from cron you've got a one-shot process that doesn't check whether there's already an instance running - that's a very bad thing.
by DougieLawson
Sun Apr 21, 2019 10:14 am
Forum: Beginners
Topic: Crontab and Terminal
Replies: 6
Views: 102

Re: Crontab and Terminal

No. Not from cron.
by DougieLawson
Sun Apr 21, 2019 9:58 am
Forum: Beginners
Topic: Crontab and Terminal
Replies: 6
Views: 102

Re: Crontab and Terminal

You cant.

crontab doesn't have a terminal. Everything runs in the background with stdout & stderr sent to /dev/null (unless you set the option to email output).

If you need access to the terminal or GUI you'll need to find some other way to start your program (usually from LXDE's autostart).
by DougieLawson
Sun Apr 21, 2019 6:20 am
Forum: Networking and servers
Topic: Can't view mysql data on to a html page
Replies: 3
Views: 90

Re: Can't view mysql data on to a html page

mysql_connect() is removed in PHP V7.0 https://www.php.net/manual/en/function.mysql-connect.php Try this version <?php $con = new mysqli("localhost", "myrestrictedSQLuser", "non-blank-password", "database_name_here"); # # Don't use SELECT * it will bite you later # #$query="select * from log_tbl"; $...
by DougieLawson
Sat Apr 20, 2019 10:33 am
Forum: Troubleshooting
Topic: Raspberry pi 3 just stops responing.
Replies: 2
Views: 66

Re: Raspberry pi 3 just stops responing.

The green LED flashing means it's not booted. The stuff on your SDCard is either not correctly written or too old for the Raspberry you're trying to use it on. Get yourself a copy of plain Raspbian https://downloads.raspberrypi.org/raspbian_latest (don't unzip it) Get yourself a copy of Etcher https...
by DougieLawson
Sat Apr 20, 2019 10:12 am
Forum: General discussion
Topic: Weather station MySQLdb problem
Replies: 2
Views: 63

Re: Weather station MySQLdb problem

You need to re-visit https://projects.raspberrypi.org/en/pro ... station/10

The code should be

Code: Select all

db = database.weather_database()
because that's instatiating a weather database object using https://github.com/RaspberryPiFoundatio ... atabase.py
by DougieLawson
Sat Apr 20, 2019 9:45 am
Forum: Beginners
Topic: ad blocker
Replies: 7
Views: 173

Re: ad blocker

by DougieLawson
Fri Apr 19, 2019 4:59 pm
Forum: Beginners
Topic: swapping boot media between models
Replies: 6
Views: 79

Re: swapping boot media between models

Get the new system booted off a new SDCard and you can then work out a way to transfer things over from your old SDCard. You can also use a new system to determine whether your old SDCard has NOOBS.

You could even consider doing all the faff to update NOOBS.
by DougieLawson
Fri Apr 19, 2019 4:57 pm
Forum: General discussion
Topic: No Wifi RasbPi 3 A+
Replies: 11
Views: 162

Re: No Wifi RasbPi 3 A+

Now that we've sorted out the wpa_supplicant.conf. There's two likely causes:

1. A version of Raspbian that's too old.
2. A power supply that's not up to the job.
by DougieLawson
Fri Apr 19, 2019 4:30 pm
Forum: Beginners
Topic: swapping boot media between models
Replies: 6
Views: 79

Re: swapping boot media between models

If apt update; apt upgrade didn't work then your SDCard must have NOOBS on it.

Forget it, it is possible to upgrade NOOBS but it's a lot of faff. Get a fresh new card, a copy of plain Raspbian (NOT NOOBS), a copy of etcher and build a fresh bootable card.
by DougieLawson
Fri Apr 19, 2019 3:04 pm
Forum: Troubleshooting
Topic: Samba client keeps asking for password and can't login.
Replies: 11
Views: 4789

Re: Samba client keeps asking for password and can't login.

hortimech wrote:
Fri Apr 19, 2019 12:24 pm
Why are you forcing everyone to be 'root' ? this is very insecure.
It's probably a NTFS filesystem mounted at /mnt with no override for uid=, & gid= on the mount command.

It is 100% insecure.
by DougieLawson
Fri Apr 19, 2019 2:57 pm
Forum: Troubleshooting
Topic: Why do I receive unreadable data via serial Port on Raspberry Pi?
Replies: 3
Views: 61

Re: Why do I receive unreadable data via serial Port on Raspberry Pi?

That's almost always going to be a baud rate problem. Check the program running in your ATMEGA8.
by DougieLawson
Fri Apr 19, 2019 2:53 pm
Forum: General discussion
Topic: Change new user privileges
Replies: 12
Views: 243

Re: Change new user privileges

That's asking for your userid's login password.
by DougieLawson
Fri Apr 19, 2019 9:28 am
Forum: Beginners
Topic: How to make the process run in background
Replies: 5
Views: 90

Re: How to make the process run in background

If the background process writes to stdout you could run it with nohup and the output goes to ./nohup.out.

If you want to run a process that starts at every boot write a SystemD service file (which can log to syslog or any file you'd like).
by DougieLawson
Fri Apr 19, 2019 9:24 am
Forum: General discussion
Topic: New Raspbian release 8th April 19
Replies: 17
Views: 710

Re: New Raspbian release 8th April 19

I'll have a chat with the webteam Monday, it's odd there is no underline. Should be there. Meanwhile, please keep things polite. If you have a problem with a post, report it, don't comment on, that just makes things worse. More odd is that the label for the link is Release notes: Link (which is so ...
by DougieLawson
Fri Apr 19, 2019 9:01 am
Forum: Troubleshooting
Topic: trouble with booting my raspberry pi 3
Replies: 2
Views: 60

Re: trouble with booting my raspberry pi 3

Why on earth did you run rpi-update? Don't ever run it again - it can break your system. MySQL has no dependencies on the kernel and bootcode versions. Rolling it back on a rescue system is non-trivial. Boot another SDCard in your RPi. Mount the broken card in a USB reader. Run this recipe. sudo -i ...
by DougieLawson
Fri Apr 19, 2019 8:59 am
Forum: Beginners
Topic: How to make the process run in background
Replies: 5
Views: 90

Re: How to make the process run in background

Either run
thang1
[CTRL]+[Z]
bg 1

Note: that job number (1 in my example) increments sequentially for each job you set into the background in this execution of the shell.

or
thang1 &
to set it running in the background when it starts.

Use
jobs
to see what's running in the background.
by DougieLawson
Fri Apr 19, 2019 8:55 am
Forum: Python
Topic: No SPI Clock
Replies: 3
Views: 67

Re: No SPI Clock

Try adding

Code: Select all

spi.max_speed_hz=500000
(with the clock speed you need).
by DougieLawson
Thu Apr 18, 2019 10:55 pm
Forum: General discussion
Topic: fsck on an image?
Replies: 1
Views: 69

Re: fsck on an image?

You can't fsck the raw device. You can only fsck the partitions on it.

So start by taking a look with sudo fdisk -l /dev/sdc then run sudo umount /dev/sdc1; sudo fsck -f -y /dev/sdc1 ... etc.
by DougieLawson
Thu Apr 18, 2019 6:20 pm
Forum: Python
Topic: crontab & overwriting results
Replies: 3
Views: 58

Re: crontab & overwriting results

The way I'd do it is to have a single script called from a SystemD service that starts at boot time. So you know there's only ever one instance running. SystemD can do startup, shutdown, status and auto restart on premature death. That removes so much overhead in getting the python runtime instantia...
by DougieLawson
Thu Apr 18, 2019 5:56 pm
Forum: Troubleshooting
Topic: Does cloning an SD clone the Pi's MAC address?
Replies: 19
Views: 396

Re: Does cloning an SD clone the Pi's MAC address?

You've got the source code for piclone, hack it to do the stuff you want like generating new SSH keys (which simply needs the files to be removed and they'll get created automagically at boot time), hostname (set to RaspberryPi unless you specify it), etc. If you get something that passes muster wit...
by DougieLawson
Thu Apr 18, 2019 5:48 pm
Forum: Advanced users
Topic: Send email on failure or restart of systemd service
Replies: 4
Views: 109

Re: Send email on failure or restart of systemd service

Easiest is to grab a copy of Nagios. That's been spamming my inbox for months.
by DougieLawson
Thu Apr 18, 2019 11:26 am
Forum: Python
Topic: crontab & overwriting results
Replies: 3
Views: 58

Re: crontab & overwriting results

Merge the scripts into one and you can properly serialise the updates to your database. Run the process for each sensor in a separate python thread.
by DougieLawson
Wed Apr 17, 2019 10:01 pm
Forum: Python
Topic: Connecting and recording data from a UGEEK Multiple Sensors Cobber v0.2
Replies: 6
Views: 103

Re: Connecting and recording data from a UGEEK Multiple Sensors Cobber v0.2

You can't get elevation without knowing your current local pressure value and an accurate value at mean sea level. If you know elevation and pressure you can calculate pressure at mean sea level. If you know pressure at mean sea level and elevation you can calculate the local pressure. #!/usr/bin/py...

Go to advanced search