@György-Farkas thanks for confirming that - i thought i'd missed something.
peter garner 0
@peter garner 0
Posts made by peter garner 0
RE: power-down -f still not shutting device down - reboots instead
Moderators: can we get these spam posts fixed pleased?
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!
power-down -f still not shutting device down - reboots instead
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?
RE: What's an efficient, low-resource CGI language to use with uhttpd ?
@luz Thanks! I've managed to install that along with liblua by downloading and installing the ipk files. Now the fun starts!
What's an efficient, low-resource CGI language to use with uhttpd ?
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.
Omega Backup / Restore Instructions revisited
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.shas 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/backupand 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.
RE: [Solved] How to stop Python oledExp writing to STDOUT/STDERR ?
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...
oledExp.setVerbosity()doesn't seem to be mentioned for the Python module, but it makes sense given it's C origins.
[Solved] How to stop Python oledExp writing to STDOUT/STDERR ?
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...")