Search found 1084 matches
- Thu Apr 16, 2020 3:11 pm
- Forum: General discussion
- Topic: Scripting woes, cannot parse inut values properly..
- Replies: 28
- Views: 1209
Re: Scripting woes, cannot parse inut values properly..
I have a general scripting question: Say that I have a variable appargs which is set by appargs=$@ So now it holds all of the command line options entered when the script started. When I want to test this (not using getopts) for example like this: if [ -z $appargs ] then echo "Missing options!&...
- Thu Apr 16, 2020 9:52 am
- Forum: General discussion
- Topic: Scripting woes, cannot parse inut values properly..
- Replies: 28
- Views: 1209
Re: Scripting woes, cannot parse inut values properly..
So I think I nailed it now! The problem seems to be the way getopts gets its input. The last argument to the getopts call is optional and if missing getopts reverts to use the full command line arguments as given by $@. But this seems not to work inside a function , so what I did was this: #!/bin/ba...
- Thu Apr 16, 2020 6:34 am
- Forum: General discussion
- Topic: Scripting woes, cannot parse inut values properly..
- Replies: 28
- Views: 1209
Re: Scripting woes, cannot parse inut values properly..
It seems not to like getopts being in a function. Possibly the arguments list is reset for a function call, though I'm not aware of that. .... Edit - you can use getopts in a function, see https://stackoverflow.com/questions/16654607/using-getopts-inside-a-bash-function but it's a much more complic...
- Thu Apr 16, 2020 5:43 am
- Forum: General discussion
- Topic: Scripting woes, cannot parse inut values properly..
- Replies: 28
- Views: 1209
Re: Scripting woes, cannot parse inut values properly..
I have tried both a ) and a), no difference.Greg Erskine wrote: ↑Wed Apr 15, 2020 11:18 pmI think a ) should be a)
c doesn't equal "a " but "a"
I started out without the space, then I saw the space in one on-line example and tried that, to no avail.
- Wed Apr 15, 2020 10:41 pm
- Forum: General discussion
- Topic: Scripting woes, cannot parse inut values properly..
- Replies: 28
- Views: 1209
Re: Scripting woes, cannot parse inut values properly..
It seems like I am hunted by ghosts when writing scripts... I cannot get the getopts function to work properly. So I have shifted to a test script just in order to get the argument parsing with getopts working. But it is not. Here is my parsetest.sh script: #!/bin/bash function showhelp { echo "...
- Wed Apr 15, 2020 3:08 pm
- Forum: General discussion
- Topic: Scripting woes, cannot parse inut values properly..
- Replies: 28
- Views: 1209
Re: Scripting woes, cannot parse inut values properly..
Thanks, I will look over the existing script, currently it is 231 lines (lots of comments).
Good ideas here!
Good ideas here!
- Wed Apr 15, 2020 1:10 pm
- Forum: General discussion
- Topic: Scripting woes, cannot parse inut values properly..
- Replies: 28
- Views: 1209
Re: Scripting woes, cannot parse inut values properly..
Thanks all! I think I will use the case structure to handle the various commands. Did not know it was available. It is very confusing when to use == and when not to... As well as how to nest if, else, elif, fi etc... Question regarding case usage (I have looked up instructions on the net): I want to...
- Wed Apr 15, 2020 9:22 am
- Forum: General discussion
- Topic: Scripting woes, cannot parse inut values properly..
- Replies: 28
- Views: 1209
Scripting woes, cannot parse inut values properly..
I am trying to multi-purpose a script I have used to install a development IDE such that I can command it to select parts of the install depending on an input argument. I have studied a lot of tutorials on bash scripting but I simply cannot get this to work.. Please tell me what I am doing wrong in ...
- Tue Apr 14, 2020 7:02 am
- Forum: General discussion
- Topic: How to read external IP address into a variable in a script?
- Replies: 2
- Views: 184
Re: How to read external IP address into a variable in a script?
Thanks!
I think it is easy enough - it is working fine!
I think it is easy enough - it is working fine!
- Tue Apr 14, 2020 6:41 am
- Forum: General discussion
- Topic: How to read external IP address into a variable in a script?
- Replies: 2
- Views: 184
How to read external IP address into a variable in a script?
I would like to log my external IP , i.e. the WAN IP address of the router, on an RPi4 unit, which sits on a mobile broadband connection. It seems like the external IP address changes frequently so I would like to create a log of the address. I can do all items in a script except I don't know how to...
- Mon Apr 06, 2020 8:44 am
- Forum: General discussion
- Topic: How to disable terminal screen blanking on non-GUI system?
- Replies: 2
- Views: 135
Re: How to disable terminal screen blanking on non-GUI system?
Thanks, I have read it and used further links and also googled "consoleblank".... But I have an issue here in that I suspect that most discussions are on how to enable the blanking or display shutdown which is the complete opposite of what I want. Also it seems as if the consoleblank param...
- Mon Apr 06, 2020 6:26 am
- Forum: General discussion
- Topic: How to disable terminal screen blanking on non-GUI system?
- Replies: 2
- Views: 135
How to disable terminal screen blanking on non-GUI system?
I am hoping someone here can help me after I have looked for a solution for hours without success... How can one permanently disable the console screen saver on a server only ( no GUI installed ) system? I have hit this "saver" on an Ubuntu 16 server installation, which kicked in during th...
- Mon Mar 30, 2020 8:20 pm
- Forum: General discussion
- Topic: Can apache on rpi4 serve markdown documents?
- Replies: 18
- Views: 705
Re: Can apache on rpi4 serve markdown documents?
It looks like there's a mod_perl2 handler -- a trivial google will find it -- which will render the thing before sending it to the browser, which should do what you want for reading. Otherwise, try a Wiki engine: most of them use a variant of it. Hmm, why mod_perl2? Should it not be mod_markdown or...
- Mon Mar 30, 2020 8:19 pm
- Forum: General discussion
- Topic: Can apache on rpi4 serve markdown documents?
- Replies: 18
- Views: 705
Re: Can apache on rpi4 serve markdown documents?
Do you mean serve or render? Have you set the right MIME-type? Well, what I mean is: - I put the file LinuxCommands.md into a web dir on the server - I use the browser and open URL http://myserver.com/doc/LinuxCommands.md - The document is shown as an MD document fully rendered in my browser (not w...
- Mon Mar 30, 2020 3:34 pm
- Forum: General discussion
- Topic: Can apache on rpi4 serve markdown documents?
- Replies: 18
- Views: 705
Re: Can apache on rpi4 serve markdown documents?
Yeah, this is basically what I have seen too. A local file system MD file renders OK (through the add-on) but not when served by apache2. I got to a state where Firefox will save the file to a local temp dir and then display it from there (if I set "open with" to Firefox). But then it is s...
- Mon Mar 30, 2020 8:27 am
- Forum: General discussion
- Topic: Can apache on rpi4 serve markdown documents?
- Replies: 18
- Views: 705
Can apache on rpi4 serve markdown documents?
I have kept notes in a txt file on my computer on various Linux issues I have encountered when working on RPi projects. Now I have converted it to a markdown document (extension md) in order to make it easier to navigate and read. It works fine in Windows 10 when I drop it onto my Firefox browser (w...
- Fri Mar 20, 2020 9:23 am
- Forum: Beginners
- Topic: command line version of piclone?
- Replies: 20
- Views: 21514
Re: command line version of piclone?
In my case I keep the backed up data on a (smaller) SDcard, which is a clone of the active SDcard. It took 24 min to create it using rpi-clone and I have verified that it is OK by running it in the RPi4. Then I have reverted to the original SDcard and continued working on the RPi4. Now I can back it...
- Sun Mar 15, 2020 5:49 pm
- Forum: General discussion
- Topic: RPi4 using WiFi only if Ethernet connection missing?
- Replies: 11
- Views: 2617
Re: RPi4 using WiFi only if Ethernet connection missing?
I just checked what happens when there is a network cable attached to the RPi4. Result: Both eth0 and wlan0 are now connected with different IP addresses on the same local network, i.e. the RPi4 has become dual-homed. Not what I wanted. ... Whilst that's not what you wanted, OOC why is it a "p...
- Sun Mar 15, 2020 2:18 pm
- Forum: General discussion
- Topic: RPi4 using WiFi only if Ethernet connection missing?
- Replies: 11
- Views: 2617
Re: RPi4 using WiFi only if Ethernet connection missing?
I just checked what happens when there is a network cable attached to the RPi4. Result: Both eth0 and wlan0 are now connected with different IP addresses on the same local network, i.e. the RPi4 has become dual-homed. Not what I wanted. So I have tried to add a check script to the boot sequence as s...
- Sun Mar 15, 2020 11:32 am
- Forum: General discussion
- Topic: RPi4 using WiFi only if Ethernet connection missing?
- Replies: 11
- Views: 2617
Re: RPi4 using WiFi only if Ethernet connection missing?
1. no connection = no ssh 2. as i said, put the wpa file in boot. Why in /boot? The WiFi configuration is already present in /etc/wpa_supplicant/ And any such file in /boot will be erased on first boot after it was put there. 3. Ethernet is always used first, the preferred, so it doesn't matter if ...
- Sun Mar 15, 2020 9:41 am
- Forum: General discussion
- Topic: RPi4 using WiFi only if Ethernet connection missing?
- Replies: 11
- Views: 2617
Re: RPi4 using WiFi only if Ethernet connection missing?
i'm not sure i get where your going, ethernet always works when connected. I do know this and it will be my preferred connection on this headless RPi4. However, if it is not possible to connect a wire to the router but a known WiFi is available, then I want it to connect to the WiFi instead if ther...
- Sun Mar 15, 2020 7:00 am
- Forum: General discussion
- Topic: RPi4 using WiFi only if Ethernet connection missing?
- Replies: 11
- Views: 2617
RPi4 using WiFi only if Ethernet connection missing?
Can I set up my Rpi4 (with Raspbian Buster Lite) such that it on boot will connect eth0 and then only if eth0 does not connect fall back to WiFi? Like this: Ethernet is wired up and receives a DHCP connection on boot: don't look at WiFi at all. Ethernet is not connecting (no cable) then and only the...
- Thu Mar 12, 2020 7:56 am
- Forum: Raspberry Pi OS
- Topic: RPi4 gets IP address from router mut not when directly on ISP
- Replies: 0
- Views: 189
RPi4 gets IP address from router mut not when directly on ISP
I have a weird problem I do not understand... I have set up my RPi4 to run as a backup server and OpenVPN server. This works well when connected to the internal router on the home LAN but when I connect the Ethernet cable directly to the fiber box eternet it winds up with the fallback address 169.25...
- Mon Mar 09, 2020 7:12 pm
- Forum: General discussion
- Topic: Ddclient on Raspbian Buster seems not to run....
- Replies: 1
- Views: 1470
Re: Ddclient on Raspbian Buster seems not to run....
What I did in the end was that I uninstalled ddclient and its dependencies, then again installed and this time I entered the requested information in the installation dialog. After it was done I opened the ddclient.conf file in nano and modified the settings according to my needs. I also made sure t...
- Sat Mar 07, 2020 7:25 pm
- Forum: Raspberry Pi OS
- Topic: IPTABLES routing syntax question
- Replies: 5
- Views: 447
Re: IPTABLES routing syntax question
Thanks, I have now added the eth0 interface as well so it looks like this when using iptables-save: sudo iptables-save # Generated by xtables-save v1.8.2 on Sat Mar 7 16:32:10 2020 *nat :PREROUTING ACCEPT [3:467] :INPUT ACCEPT [3:467] :POSTROUTING ACCEPT [2:136] :OUTPUT ACCEPT [2:136] -A POSTROUTING...