|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
Shell - how to take variables from browser
I need to write a shell script which can take variables from a browser URL and incorporate them into the script.
However, I've never written a shell script before... I'm pretty sure I can find the basic syntax used in shell scripts online, but I haven't thusfar been able to locate documentation on how to get variable values from a URL into the shell. Any help here with the basic concepts involved is appreciated... examples of code are really what I need most, so those are most appreciated. Thanks...
__________________
Give a person code, and they'll hack for a day; Teach them how to code, and they'll hack forever. Analyze twice; hack once. The world's first existential ITIL question: If a change is released into production without a ticket to track it, was it actually released? About DrGroove: ITIL-Certified IT Process Engineer - Enterprise Application Architect - Freelance IT Journalist - Devshed Moderator - Funk Bassist Extraordinaire |
|
#2
|
||||
|
||||
|
What exactly is that you wan't to do?
If you wan't to get all the of file of a certain type you'd better off with a www crawler. Otherwise you'll probably need lynx to dump the html (or not) and use grep or sed to fetch what you're looking for.
__________________
Words must be weighed, not counted. |
|
#3
|
||||
|
||||
|
Basically, I'm trying to allow rsync to be executed - with files/folders specified - from a web browser.
I was using system() to send the rsync command to the server, but user 'nobody' cannot run rsync. So, my thought was to write a shell script, which would store the rsync command, but I need the command to take arguments. Any ideas? |
|
#4
|
||||
|
||||
|
Wrap it up with sudo, that should do it.
|
|
#5
|
||||
|
||||
|
thats a good idea... i'll try that. thanks riv!
|
|
#6
|
||||
|
||||
|
riv, i hate to even ask this, but for as much as I've read on sudo so far, i'm not 'getting it'., so I was wondering if you could perhaps provide examples as to how it 'looks'
i checked out the sudo.ws site, and found their examples page: http://sudo.ws/sudo/man/sudo.html#examples right now i'm hitting the server via system() w/ the rsync command. system() is executed as user 'nobody', since i'm coming in through a web browser. how does sudo allow me to log in as, lets say, user 'drgroove' w/ pass 'y0m8m8' ? the examples on the sudo.ws site show where the 'user' would go in the sudo command, but not the password... thats the part i'm not getting. |
|
#7
|
||||
|
||||
|
This portion is more helpfull
Basically this is what you need: Code:
un ALL=ALL NOPASSWD: ALL Where un is the username. You may wan't to tweak it to allow a fine grained security but at least it does the job. |
|
#8
|
||||
|
||||
|
erg... hrm. OK. I can discuss this w/ the Unix admin here... I mean, basically, I don't have access to how the sudo app is setup on our server, I just know its installed... I'm just not sure what the basic syntax of sudo itself is, and can't seem to locate any examples that just show where to put the username & password into the sudo command, and then where these would go in relationship to the rsync command... guess i'll just start typing code until I hit the right combination!
![]() |
|
#9
|
|||
|
|||
|
the command is simple:
sudo -u username command but your sysadmin needs to allow you to do this - you better talk to him first ![]()
__________________
-- Manuel Hirsch - Linux, FreeBSD, programming, administration articles, tutorials and more. |
|
#10
|
||||
|
||||
|
thanks m.hirsch ... i'll do just that
![]() |
![]() |
| Viewing: Dev Shed Forums > Operating Systems > Linux Help > Shell - how to take variables from browser |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|