That's my first attempt here in the forum but I don't now how to proceed with my problem.
I made myself a little digital diary where I can power up a Pi Zero just with an attached keyboard and write some stuff that I have on my mind.
Unfortunately most of the time the files I create are just empty. I tried to find a scheme about when this occurs but I don't see one.
I think when I'm in reach of my home Wifi the chances of having the text beeing saved is higher.
But the idea is to have this thing with me an write from time to time.
Here is the code:
Code: Select all
cd /home/pi/Documents/timestamped_texts/bin/
./blink.py & #that triggers a flashing LED attached to the nano to show me the text document is open
cd /home/pi/Documents/timestamped_texts/
sudo nano $(date +%Y%m%d_%H%M%S)_$(($RANDOM % 10))$(($RANDOM % 10))_ #that creates the document to write in
cd ~/
kill $(pgrep blink.py) # after finishing the file the blinking stopps
ctrl + x
ctrl + y
(optionally adding a title)
enter
(optionally hitting y when I entered a title)
according to my script the blinking stops and I know everything should be fine.
The file names come out very nicely just the emptiness of the documents is not was I was looking for...
Interesting is that the modified date reflects correctly how long I wrote in the file.
But nevertheless it's just empty.
For having the correct time in the timestamp I just added a RTC module that syncs the correct system time on startup.
I thought that might fix my problem. But unfortunately it didn't.
Any ideas would be highly appreciated!
Thanks in advance!
PS: On my Linux Mint notebook I run the same command and everything works as expected...
Code: Select all
sudo nano $(date +%Y%m%d_%H%M%S)_$(($RANDOM % 10))$(($RANDOM % 10))_