Hi
TC user script works for busybox or real wget command.
When I add in my root stuff, it borks
First is the TC script
#!/bin/sh
LIST="bigreqsproto-1.1.2.tar.bz2 compositeproto-0.4.2.tar.bz2"
for Z in $LIST
do
wget http://xorg.freedesktop.org/releases/individual/proto/$Z
done
Result (as expected) (culled output to keep it short)
sh wgettest
2013-06-09 03:02:51 (129 KB/s) - `bigreqsproto-1.1.2.tar.bz2' saved [113218/113218]
2013-06-09 03:02:53 (94.7 KB/s) - `compositeproto-0.4.2.tar.bz2' saved [101208/101208]
2) Now do it as root with a modest tweak?
#!/bin/sh
if [ "$USER" != "root" ] ; then
echo "Run as root please, exiting."
exit 1
fi
LIST="bigreqsproto-1.1.2.tar.bz2 compositeproto-0.4.2.tar.bz2"
for Z in $LIST
do
su -c '/usr/local/bin/wget http://xorg.freedesktop.org/releases/individual/proto/$Z ' tc
done
Results not culled for trouble shooting.....wget is loaded BTW, script added to /tmp
sudo su && cd /tmp
sh wgettest
--2013-06-09 02:59:38-- http://xorg.freedesktop.org/releases/individual/proto/
Resolving xorg.freedesktop.org... 131.252.210.176
Connecting to xorg.freedesktop.org|131.252.210.176|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: `index.html
[ <=> ] 92,004 108K/s in 0.8s
2013-06-09 02:59:40 (108 KB/s) - `index.html' saved [92004]
--2013-06-09 02:59:40-- http://xorg.freedesktop.org/releases/individual/proto/
Resolving xorg.freedesktop.org... 131.252.210.176
Connecting to xorg.freedesktop.org|131.252.210.176|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: `index.html.1'
[ <=> ] 92,004 47.4K/s in 1.9s
2013-06-09 02:59:42 (47.4 KB/s) - `index.html.1' saved [92004]
Any clues?
It looks like it does not like the Z variable but why not?
(work a round)
I could have my script start as TC or local user, then sudo su after wgets but it would be nice to know what I am doing wrong,
having only just learnt loops thanks to Rich, I was sure I had it, until nasty old root would not play ball
cheers
Gordon
### trivia, I am aware how to use wget's wget command with an extra "-O /tmp/filename" to stop root downloading the files into TC