What's that about my funeral? Do you know something I don'tIt's your funeral, not ours. Do it whatever way you like. We can only advise (and any advice given is purely voluntary – there is no beef).
I have generated a key pair on the NAS and sent it to the FoxsatPerhaps it does make some sense, if you mean the NAS script Telnets into the Foxsat to send the command for the Foxsat to run. But it doesn't really account for error responses, and the Telnet login credentials will have to be stored in the NAS script in the clear (if security bothers you). A significant reason for not injecting commands to a remote system are the security implications: file access permissions are lower risk than command access.
I have written a couple of bash files and placed them inside the foxsat, one to mount, the other to unmount. It appears that unmounting does nothing useful though. If the NAS is unmounted while the foxsat is playing, it seems the foxsat continues to play? I guess that the network is marked as busy so though the command it sent, it actually hasn't dropped the mount. If the network disconnects while NAS is mounted, play freezes, and after a while, a message shows up saying the channel in encrypted. That's fine though.Fundamentally, the NAS should be an extension to the Foxsat's file system. It is therefore far more logical that the Foxsat is in control of the process. How do you plan to handle unmounting when the NAS drops out? What happens if the Foxsat wasn't responding at the time the NAS booted?
Yes. I would have you locked up if I were the people you'd inflicted it on. But then you might think that about meDoes that make me sadistic or masochistic? Maybe a little of both![]()
I guess it's a lazy unmount i.e. it will unmount when the last file using it is closed.If the NAS is unmounted while the foxsat is playing, it seems the foxsat continues to play?
Bash is not C. As /df always says, shellcheck.net is your friend.Unfortunately I got stuck with a stupid bash problem.
#!/bin/sh
if true; then
echo Yes
else
echo No
fi
I'm a good buoy I am, honest guvnaYes. I would have you locked up
I'll look at that site, thanks. I have to stop you at line 1 though as no such directory exists on the Foxsat so I removed it yesterday from the mount and unmount files just to get it to work. There is a sh link to nowhere in /bin. Script seems to default to bash without it, so when I got time, I will use find to look for 'dash'. Think the root of the file system is locked into flash memory so it be somewhere different. There's a lack of bash commands to check what's mounted in the Foxsat so I decided to look for the IP address of the NAS in the mount instead. If it's there, it's mounted, if not, it isn't.Bash is not C. As /df always says, had to remove as I'm not allowed to post external links yet, even as a quote is your friend.
#!/bin/sh if true; then echo Yes else echo No fi
/bin/mount | grep 192.168.143.12 > /dev/null && r=true || r=false;
echo $r
if ($r); then
echo"hurrah"
else
echo"Boooo!!" ;
fi
exit 0
Foxsat-HDR~# /mnt/hd4/opt/bash/NASPing.sh
: not foundt/bash/NASPing.sh: /mnt/hd4/opt/bash/NASPing.sh: 1:
false
/mnt/hd4/opt/bash/NASPing.sh: /mnt/hd4/opt/bash/NASPing.sh: 10: Syntax error: end of file unexpected (expecting "fi")
Foxsat-HDR~#
Foxsat-HDR~#
Foxsat-HDR~# /mnt/hd4/opt/bash/NASmount.sh
Foxsat-HDR~#
Foxsat-HDR~# /mnt/hd4/opt/bash/NASPing.sh
: not foundt/bash/NASPing.sh: /mnt/hd4/opt/bash/NASPing.sh: 1:
true
/mnt/hd4/opt/bash/NASPing.sh: /mnt/hd4/opt/bash/NASPing.sh: 10: Syntax error: end of file unexpected (expecting "fi")
Foxsat-HDR~#
Foxsat-HDR~#
It was meant as a generic Linux example, not a specific Foxsat thing. Where does /bin/sh point to then? I'd have thought almost every Linux on the planet had that valid, but I no longer have access to a Foxsat to check.I have to stop you at line 1 though as no such directory exists on the Foxsat so I removed it yesterday from the mount and unmount files just to get it to work. There is a sh link to nowhere in /bin.
Foxsat-HDR~# ls -l /bin/shWhere does /bin/sh point to then?
A bit harshThe rest of your stuff seems to suffer from typos or something (as well as residual C style coding).
a="Wednesday"
if [ $a = "Wednesday" ] ; then
echo "It's Wednesday"
else
echo "it's not Wednesday"
fi
I have to stop you at line 1 though as no such directory exists on the Foxsat so I removed it
There is a sh link to nowhere in /bin
all 53 links in /bin point to busybox
Foxsat-HDR~# ls -l /bin/sh
lrwxrwxrwx 1 root root 7 Feb 9 2014 /bin/sh -> busybox
Foxsat-HDR/opt# ls /bin
[ chmod df find hexdump ln mount ping run-parts su umount
[[ chown dmesg free hostname login mv ps sed tar unzip
ash cp echo grep id ls nice pwd seq test wget
busybox date egrep gunzip kill mkdir nslookup rm sh time zcat
cat dd fgrep gzip killall mknod passwd rmdir sleep touch
Foxsat-HDR/opt#
Foxsat-HDR/opt#
Foxsat-HDR/opt# cat ./test.sh
#!/bin/sh
a="Wednesday"
if [ $a = "Wednesday" ] ; then
echo "It's Wednesday"
else
echo "it's not Wednesday"
fi
Foxsat-HDR/opt#
Foxsat-HDR/opt#
Foxsat-HDR/opt# ./test.sh
It's Wednesday
Foxsat-HDR/opt# cat ./test2.sh
#!/bin/sh
/bin/mount | grep 192.168.143.12 > /dev/null && r=true || r=false;
echo $r
if ($r); then
echo "hurrah"
else
echo "Boooo!!"
fi
exit 0
Foxsat-HDR/opt#
Foxsat-HDR/opt#
Foxsat-HDR/opt# ./test2.sh
false
Boooo!!
Foxsat-HDR/opt#
I was about to suggest that.My guess is that this could be a CRLF thing.
Probably, using Notepad! @TW8: download Notepad++ and set "Unix line endings" in preferences (or whatever the setting is – you need it to output LF only). Alternatively, create your scripts directly on the Foxsat with a command-line editor (vi, nano).Are you creating/editing your scripts on Windows by any chance
Bash on the Foxsat works like bash on any other system. You just don't appear to know how to use it properly. I would suggest reading up on the correct syntax rather than guessing.I just can't get bash on the foxsat to deal with any 'if' statement.
As others have said, I expect you are not using Unix line endings. I gave you a sample in #23. If you can't get that to work then you are doing something fundamentally wrong which needs fixing before moving on.It either complains 'expecting then' or "expecting fi'.
So none of that is true. I might leave you to it.I have to stop you at line 1 though as no such directory exists on the Foxsat so I removed it yesterday from the mount and unmount files just to get it to work. There is a sh link to nowhere in /bin.
You were absolutely correct about CR/LF. When I set the file to unix mode, it runs perfectly. Thank you so much. Script pings works from the command line, not tried it from command line yet.My guess is that this could be a CRLF thing.
Thank you too. I appreciate your help and ideas on this too.I was about to suggest that.
#!/bin/sh
ping -c 1 192.168.143.12 > /dev/null && conx=1 || conx=0
/bin/mount | grep 192.168.143.12 > /dev/null && mounted=1 || mounted=0;
if [ $conx = "1" ] && [ $mounted = "0" ] ; then
mount -t cifs -o user=****,password=**** "//192.168.143.12/Video" /media/sdb1
fi
if [ $conx = "0" ] && [ $mounted = "1" ] ; then
umount -l /media/sdb1
fi