@David-Kerr thanks - i'd considered the hardware option but I don't want to damage my board
I will have a poke around the power-dock-2 script and see if i can figure something out from that.
@David-Kerr thanks - i'd considered the hardware option but I don't want to damage my board
I will have a poke around the power-dock-2 script and see if i can figure something out from that.
Any takers? I'm keen to know as I did a battery test yesterday and achieved just over 12 hours with a 3000mAh LiPo battery. Initially the Omega was just idling, but then I set up a wget my homepage in a loop to give it some exercise. Very impressive.
If I can query it programatically I can then either shut it down gracefully or get the proxy to divert.
I'm running my Omega2 pro via a 5v USB feed at the moment, and there's a LiPo battery also plugged in for backup. If I disconnect the main power it switches over just fine but what I want to do is to be able to detect that this (and vice versa) when it returns.
Is there any way I can do this via software, preferably with Python(3) as I want to be able to raise a notification?
@crispyoz thanks i'll give that a try. I'm always a bit wary if removing system-sounding things
Hi all,
I'm busy tuning my new Onion 2Pro (great machine!) and have come across a process called onion-helper. I'm trying to get rid of unnecessary process to make as lean a machine possible, so if I can disable this via /etc/init.d, I will. All I can figure out is that it respawns if terminated, but other than that, no idea. Can anyone advise please?
@crispyoz Man thanks for this! I get regular DDoS attacks on my other home-hosted servers, so there's no reason to expect my little Onion device to escape, unfortunately.
I'll check out Nginx when I get the 2Pro and I'll also try lighttpd as well as that seems to have a low resource requirement. The device will only be running the web server and SSH so I don't anticipate too many resource issues, but we'll see!
I'll post something here when it's up and running!
Hi all,
After a long break i've ordered an Omega 2Pro for my next project. I want to set up an Internet-facing low-traffic web server using the onboard uhttpd and add a LetsEncrypt cert to it to provide https. This has been inspired by an earlier project based on Piratebox - I ran a DLNA server on a 2+ and it uworked really well. Eventually the device may be solar-powered. From what I've read, i'll probably have to create certs manually on a different machine and copy the certs over.
So, based on your knowledge of these things, should i be using uhttpd in this way? I have extensive experience of lighttpd and nginx, but these would probably be overkill, and i don't need PHP.
Any comments/questions welcome!
@György-Farkas thanks for confirming that - i thought i'd missed something.
Hello Mods,
I'm disturbed by the number of spam posts appearing recently. Like the majority of visitors here, i come for the technical discussions, not to read some scammy schemes cluttering up a valuable resource. It also detracts from the brand. So please sort it out!
Device Firmware Version: 0.2.2 b200
i think i've tried all variations of this command now and still can't seem to shut my Omega 2P down fully; it tells me it's "shutting down / bye" but then decides to reboot.
Is there anything else i can try?
@luz Thanks! I've managed to install that along with liblua by downloading and installing the ipk files. Now the fun starts!
I want to write some simple CGI scripts, for example a page-load counter for visitors to a web page running on the stock uhttpd web server. The ability to include an external file would also be really useful but not a deal breaker if it can't be done.
I've set up a content-streamer using uhttpd as the front page, and minidlna as the streamer. I think Python3-light is probably overkill (and rather large). Same for PHP7 I think.
Any suggestions would be appreciated.
Re: Omega Backup / Restore Instructions
I decided I needed to be able to backup my 4 (and counting!) Omega2 and Omega2+ devices, ideally to one place using the instructions in the aforementioned post.
I erased a spare USB stick under Linux and created 4 primary partitions, each the same size. I labelled each partition with the relevant 4 characters of the MAC address (shown obfuscated here).
On each Onion I then created the /mnt/backup directory before running /root/backup.sh
as shown below.
#!/bin/sh
# backup.sh
# From: https://community.onion.io/topic/2677/omega-backup-restore-instructions
# My machines use /dev/sdb - YMMV !
# get the machine name
MACHINE=`/bin/uname -n`
# get today's date
TODAY=`date +%Y-%m-%d`
# which machine am I on?
if [ $MACHINE = Omega-0001 ]; then
mount /dev/sdb1 /mnt/backup
elif [ $MACHINE = Omega-0002 ]; then
mount /dev/sdb2 /mnt/backup
elif [ $MACHINE = Omega-0003 ]; then
mount /dev/sdb3 /mnt/backup
elif [ $MACHINE = Omega-0004 ]; then
mount /dev/sdb4 /mnt/backup
else
echo "machine $MACHINE unknown - exit"
exit
fi
echo "Backing up $MACHINE"
# final check, to be sure ...
if [ -d /mnt/backup ]; then
echo "backing up..."
else
echo "NO BACKUP DEVICE found - exit"
exit
fi
# standard MTDs
dd if=/dev/mtd0 of=/mnt/backup/uboot.bin
dd if=/dev/mtd1 of=/mnt/backup/ubootenv.bin
dd if=/dev/mtd2 of=/mnt/backup/factory.bin
dd if=/dev/mtd3 of=/mnt/backup/firmware.bin
dd if=/dev/mtd4 of=/mnt/backup/kernel.bin
dd if=/dev/mtd5 of=/mnt/backup/rootfs.bin
dd if=/dev/mtd6 of=/mnt/backup/rootfsdata.bin
# export UCI settings for good measure
uci export > /mnt/backup/UCIexport_$TODAY
echo "all done"
exit
Once the backup is complete on each machine you can then umount /mnt/backup
and remove the USB stick.
So looking at the finished 4 backups on another Linux box, the USB stick is mounted on /dev/sdC, here's a typical directory listing:
ls -l /media/peter/0004-backup
total 41056
-rwxr-xr-x 1 peter peter 1086 Jul 10 13:41 backup.sh
-rw-r--r-- 1 root root 65536 Jul 10 13:38 factory.bin
-rw-r--r-- 1 root root 16449536 Jul 10 13:39 firmware.bin
-rw-r--r-- 1 root root 1341962 Jul 10 13:39 kernel.bin
drwx------ 2 root root 16384 Jul 10 13:08 lost+found
-rw-r--r-- 1 root root 15107574 Jul 10 13:39 rootfs.bin
-rw-r--r-- 1 root root 8781824 Jul 10 13:39 rootfsdata.bin
-rw-r--r-- 1 root root 196608 Jul 10 13:38 uboot.bin
-rw-r--r-- 1 root root 65536 Jul 10 13:38 ubootenv.bin
-rw-r--r-- 1 root root 6459 Jul 10 13:39 UCIexport_2019-07-10
... and free space:
df -h /dev/sdc*
Filesystem Size Used Avail Use% Mounted on
udev 3.9G 0 3.9G 0% /dev
/dev/sdc1 6.9G 120M 6.4G 2% /media/peter/0001-backup
/dev/sdc2 6.9G 120M 6.4G 2% /media/peter/0002-backup
/dev/sdc3 6.9G 72M 6.5G 2% /media/peter/0003-backup
/dev/sdc4 6.9G 72M 6.5G 2% /media/peter/0004-backup
As you can see, my USB stick is way too big and I'll see if I can find a smaller device instead.
Got it! Thanks for that. I actually had to do it in this order:
oledExp.setVerbosity(-1)
oledExp.driverInit()
oledExp.write("Hello World")
I wasn't expecting to have to set the verbosity before the init but there you go...
Actually, oledExp.setVerbosity()
doesn't seem to be mentioned for the Python module, but it makes sense given it's C origins.
This is my second project using Python 2 oledExp and I'm having the same problem as before. When I SSH into the Onion2 and run my script I get this:
./clock.py
> Setting display to ON
> Initializing display
> Writing 'Wed 10 Jul 2019' to display
> Writing '08:03 +0100' to display
> Writing 'Local Time BST' to display
and the output also appears on the display, as planned. is there any way that I can stop the above appearing? I just need it to appear on the display. Here is what I've tried so far:
within the script:
old_stderr = sys.stderr
old_stdout = sys.stdout
sys.stderr = open(os.devnull, 'w')
sys.stdout = open(os.devnull, 'w')
and in crontab:
crontab -l
*/1 * * * * /root/clock.py >/dev/null 2>&1
#
and here's the top of the script with a write statement:
oledExp.setDisplayPower(1)
oledExp.driverInit()
oledExp.setBrightness(127)
oledExp.setTextColumns()
oledExp.setDisplayMode(0)
oledExp.setVerbosity(0)
oledExp.clear()
...
oledExp.setCursor(0,0)
oledExp.write("the time is now...")
I can't seem to edit this and the image doesn't display, so here's the link:
I don't know if you folk are ham-fisted like me and always manage to bend a few pins when extracting a chip out of the dock? Well, I had an idea for a new, small tool -- a device that operates like a scissor jack that you could place under your chip and raise it in parallel. Something like this:
what do you think?
@luz said in Onion Omega2+ as NTP client ?:
there is a ntpd installed and running already as client
Ah, I see! That makes sense now. So all I really need to do is to write the time to the OLED at regular intervals - every minute is good enough - and ntpd will take care of fetching the time.
Great! Thanks ...
I want to set up a spare Omega2+ with OLED display as a dedicated NTP client network clock.
I run a GPS-based Raspberry Pi as an NTP server and have set up my Omega2 devices to get the time from that. So far so good. However, I'm trying to find an NTP client using opkg and can't find one.. What do I need to use?
Thanks in advance.