Search Results
|
Post |
Author |
Forum |
Replies |
Views |
Posted
[asc]
|
|
|
Thread: Help creating shell scrip for python file
Post: RE: Help creating shell scrip for python file
Got it...plus the csv file was giving me permission denied error as well, so i changed it to envirolog.log instead and it works!
Thanks so much!
(Sep-16-2023, 08:06 PM)Gribouillis Wrote: Try
Outp... |
|
marciokoko |
General Coding Help |
10 |
1,383 |
Sep-16-2023, 09:27 PM |
|
|
Thread: Help creating shell scrip for python file
Post: RE: Help creating shell scrip for python file
Thanks,
I fixed one of the paths, I was actually missing the "/" before "home" on crontab. So now I get this error in the cronlog.log:
/bin/sh: 1: /home/mkzero/shenviro.sh: Permission deniedHow do ... |
|
marciokoko |
General Coding Help |
10 |
1,383 |
Sep-16-2023, 07:52 PM |
|
|
Thread: Help creating shell scrip for python file
Post: RE: Help creating shell scrip for python file
I also fixed the path in the crontab -e as well to:
*/2 * * * * home/mkzero/shenviro.sh > /home/mkzero/cronlog.log 2>&1and i get this still:
/bin/sh: 1: home/mkzero/shenviro.sh: not foundI... |
|
marciokoko |
General Coding Help |
10 |
1,383 |
Sep-16-2023, 07:05 PM |
|
|
Thread: Help creating shell scrip for python file
Post: RE: Help creating shell scrip for python file
envirophat2.py is in my user home directory. I havent created the log file envirolog.csv, so ill do that now.
So my shenviro.sh file is now:
Quote:/usr/bin/python3 /envirophat2.py >> /envirol... |
|
marciokoko |
General Coding Help |
10 |
1,383 |
Sep-16-2023, 06:53 PM |
|
|
Thread: Help creating shell scrip for python file
Post: RE: Help creating shell scrip for python file
Ok well so here is what i have then:
crontab:
*/2 * * * * /shenviro.sh echo "hi there"shenviro.sh
#!/bin/bash
/usr/bin/python3 /envirophat2.py >> /envirolog.csvenvirophat2.py
#!/usr/local/bin/... |
|
marciokoko |
General Coding Help |
10 |
1,383 |
Sep-16-2023, 05:04 PM |
|
|
Thread: Help creating shell scrip for python file
Post: Help creating shell scrip for python file
Hi guys,
So Im reading through this git (https://github.com/cubapp/RasPi-EnviropH...ree/master) and the author writes:
Quote:I call the Python from a shell script via crontab:
$ crontab -l
*/2 ... |
|
marciokoko |
General Coding Help |
10 |
1,383 |
Sep-16-2023, 04:18 PM |
|
|
Thread: Python loop for posting data to web
Post: RE: Python loop for posting data to web
bump again...help anyone?
I still havent been able to figure this out... |
|
marciokoko |
General Coding Help |
10 |
1,562 |
Aug-25-2023, 10:11 PM |
|
|
Thread: Python loop for posting data to web
Post: RE: Python loop for posting data to web
Hi guys, just wanted to bump this thread because I've made no progress on this situation. For some reason the script isnt running at the start in rc.local but it does run from the terminal using the ... |
|
marciokoko |
General Coding Help |
10 |
1,562 |
Jul-27-2023, 01:30 PM |
|
|
Thread: Python loop for posting data to web
Post: RE: Python loop for posting data to web
Ok sorry to jump around but i decided to move it to rc.local because i remember reading (might be wrong though) that sometimes crontab starts up too fast and scripts arent run because certain "things"... |
|
marciokoko |
General Coding Help |
10 |
1,562 |
Jul-20-2023, 10:54 PM |
|
|
Thread: Python loop for posting data to web
Post: RE: Python loop for posting data to web
Ok and how do I do that? I believe I have installed both 2.7 and 3. How do I get the path for each?
I know i have 3.9.2 from doing python -V
and this:
mkzero@raspberrypi:~ $ which python
/usr... |
|
marciokoko |
General Coding Help |
10 |
1,562 |
Jul-20-2023, 10:25 PM |
|
|
Thread: Python loop for posting data to web
Post: RE: Python loop for posting data to web
Ok I’ll try that but it’s weird because I have animo their script that runs fine without making the file executable.
(Jul-19-2023, 05:17 PM)deanhystad Wrote: To schedule with crontab you should ge... |
|
marciokoko |
General Coding Help |
10 |
1,562 |
Jul-19-2023, 08:11 PM |
|
|
Thread: Python loop for posting data to web
Post: RE: Python loop for posting data to web
Ok here is how I run the script on reboot:
@reboot python3 /home/mkzero/envirophat2.py &And here is the code I ended up with based on your suggestion:
#!/usr/local/bin/python3
from envirophat im... |
|
marciokoko |
General Coding Help |
10 |
1,562 |
Jul-18-2023, 11:01 PM |
|
|
Thread: Python loop for posting data to web
Post: Python loop for posting data to web
I got this code for posting data to thingspeak from a raspberry pi (zero):
#!/usr/local/bin/python3
from envirophat import light, motion, weather, leds
import thingspeak
import time
from datetime im... |
|
marciokoko |
General Coding Help |
10 |
1,562 |
Jul-17-2023, 07:33 PM |
|
|
Thread: How do I make RPi run script on startup?
Post: RE: How do I make RPi run script on startup?
Thx! That did it!
Do you know if I can include that tmux new -s sessionName in the .bashrc? It wont freeze up my rpi? :-) |
|
marciokoko |
General Coding Help |
6 |
5,618 |
Feb-07-2017, 01:08 AM |
|
|
Thread: How do I make RPi run script on startup?
Post: RE: How do I make RPi run script on startup?
I'm sorry, but would that code be OK?
I'm afraid of adding it and then getting my RPi stuck in some infinite loop or something.
I tried doing:
chmod a+x scriptname.py but I got this:
chmod a+x reco... |
|
marciokoko |
General Coding Help |
6 |
5,618 |
Feb-06-2017, 11:21 PM |
|
|
Thread: How do I make RPi run script on startup?
Post: RE: How do I make RPi run script on startup?
#Mars personal mods
Ok I need to create a tmux session and then run 2 scripts. Would this work?
#FIRST:run create tmux session
#SECOND: run reconnect.py to reconnect serialbt on rpi to bt relay ... |
|
marciokoko |
General Coding Help |
6 |
5,618 |
Feb-02-2017, 09:07 PM |
|
|
Thread: How do I make RPi run script on startup?
Post: How do I make RPi run script on startup?
I have a RPi2 running a script indefinitely with a scheduler. But when the power goes out, which is often, the RPi2 reboots and I have to type "python scriptname.py" again to get it back up and runni... |
|
marciokoko |
General Coding Help |
6 |
5,618 |
Feb-02-2017, 03:10 AM |
|
|
Thread: Run python script in RPi2 from ssh session
Post: RE: Run python script in RPi2 from ssh session
Thanks! Gr8 stuff! Im using tmux |
|
marciokoko |
General Coding Help |
5 |
5,045 |
Jan-23-2017, 09:53 PM |
|
|
Thread: Run python script in RPi2 from ssh session
Post: RE: Run python script in RPi2 from ssh session
Hi, thanks. Where does that line go exactly?
Currently I ssh into the pi, go to the python script's directory and type:
python myscriptname.pySo you're saying that if I type in the start_server.py ... |
|
marciokoko |
General Coding Help |
5 |
5,045 |
Jan-23-2017, 06:39 PM |
|
|
Thread: Run python script in RPi2 from ssh session
Post: Run python script in RPi2 from ssh session
If I run a python script on a RPi2 from an ssh session, that script stops once the ssh session is terminated. How do I make that python script run in the RPi2 indefinitely and irrespective of what ha... |
|
marciokoko |
General Coding Help |
5 |
5,045 |
Jan-23-2017, 01:31 AM |